Trucos En Gnuplot
GNUplot y Xfig
5 de Octubre, 2016
Export a plot from GNUplot to Xfig |
Save the plot int the terminal "fig": set terminal fig set output "myfigure.fig" plot x, x**2 Open the file with "myfigure.fig" using Xfig. |
FOR LOOP
June 5, 2016
PLOT MULTIPLE FILES |
If we have many files, let's say plot "data1.txt" using 1:2 title "Data 1", \ "data2.txt" using 1:2 title "Data 2", \ . . . "data1000.txt" using 1:2 title "Data 1000" However, we could use the plot for [j=0:1000:100] sprintf('data%i.dat',j) u 1:4 w l t sprintf('Data %i',j) In this example, plot for [j in system('ls HHe0*/E.dat')] sprintf('%s',j) w lp t sprintf('%s',j) VASP users may like this: plot for [j in "08 12 16 24 32"] sprintf("<awk '/LOOP\\+/{print}' Simulation-%s/OUTCAR",j) u 0:7 w lp t sprintf('Simulation-%s.dat',j) |
GENERATE PLOTS FROM A FILE WITH MULTIPLE TABLES |
Let's consider a file written in the following way # x f(x) 0.1 0.0998334 0.2 0.198669 0.3 0.29552 # x f(x) 0.1 0.891207 0.2 0.932039 0.3 0.963558 . . . # x f(x) 0.1 -0.625071 0.2 -0.699875 0.3 -0.767686 If each block corresponds to a function f(x) at a given step, in principle we would have to divide this files in many small files, and then plot all of them using plot "data1.txt" using 1:2 title "Block 1", \ "data2.txt" using 1:2 title "Block 2", \ . . . "data1000.txt" using 1:2 title "Block 6" To avoid doing this, and be able to do everything at once from the original file, we will extract each block using filename(b,j) = sprintf("<awk 'NR>%i*%i && NR<=%i*(%i+1){print}' temp.dat", b,j,b,j) plot for[j=0:900:300] filename(4,j) u 1:2 w lp t sprintf("Block %i",j) The variable |