Main page | Research | Utilities | Links

Gnuplot Utilities

Animations:

I created a script called 2danimate.bash that animates the plotting of a 2D data file (containing two columns of values corresponding to x and y respectively).
The script 2danimate.bash can be downloaded from here. Where data.dat is the data file, and 5 is a number proportional to the velocity of the animation. You can substitute 5 by any number between 1 to 10. 0:1 is the x range and -1:1 is the y range. Replace those numbers by the range needed, maintaining the same format: Xmin:Xmax Ymin:Ymax. To stop the animation it's necessary to press <Ctrl>+<c> from the terminal. You can download an example of an input data file from here. The example of the corresponding output file is like the animation below:

LaTeX animation In order to see the animation embedded in a PDF file, you can take a look at this example (at this moment only works in Acrobat Reader 6 or later).

Histograms:

Here is a simple way (due to David MacKay) to make histograms in Gnuplot. In this example, there are two input data files containing a single column of measurements. The sample input files can be downloaded from here and from here.
The Gnuplot script file is as follows:

set size 0.65,0.6

set key 0.7,0.19 Left reverse samplen 1 spacing 1.4

set border 31 lw 0.5

set xlabel '$d_e$ (mm)' 0,0.2
set ylabel '$P(d_e)$' 1.6,0

set ytics 0.05

set style fill solid 0.95 border -1
set boxwidth 0.0625

bin_width = 0.125
bin_number(x) = floor(x/bin_width)
rounded(x) = bin_width * (bin_number(x) + 0.5 )

bin_width2 = 0.125
bin_number2(x) = floor(x/bin_width2)
rounded2(x) = bin_width2 * (bin_number2(x) + 0.5 )

UNITY = 1.0

plot 'histogram-0g.dat' u (rounded($1)):(UNITY/202) t '0g' smooth frequency w boxes linecolor rgb '#aaaaaa' lw 0.5,\
'histogram-1g.dat' u (rounded2($1)-0.0625):(UNITY/101) t '1g' smooth frequency w boxes linecolor rgb '#555555' lw 0.5


and can be downloaded from here.
The result is a plot like this:

Histogram