Appendix B – Operating tips for gnuplot


Gnuplot is a graphics package produced by the Free Software Foundation and is freely distributable under the terms of the GNU Project’s General Public Licence (GPL). See for more information on the GPL or gnuplot.


The gnuplot interface used in this study was the X11 interface (i.e. all output was directed to the screen). It may be noted that the output may be redirected to a file for later processing. Issue the gnuplot command

set term

to see a list of supported file types.

Load Files

A file may be given to gnuplot which contains a series of gnuplot commands, each of which will be executed in sequence. This may be used to create a rudimentary animation sequence of the evolution of the wave packet. For example if the file anim.txt contained the lines:

splot [0:45] [0:30] [0:0.5] 'slit0001.da' w l , 'slitp.dat' w l

splot [0:45] [0:30] [0:0.5] 'slit0002.da' w l , 'slitp.dat' w l

splot [0:45] [0:30] [0:0.5] 'slit0003.da' w l , 'slitp.dat' w l

splot [0:45] [0:30] [0:0.5] 'slit0004.da' w l , 'slitp.dat' w l

and the gnuplot command

     load 'anim.txt'

is given, then four files slitXXXX.da are plotted one after the other.

Note that the letters w l are short for with lines and it appears that this is faster for gnuplot to interpret. Providing the range of each of the axes (e.g. [0:45] [0:30] [0:0.5]) makes for faster rendering. It is worth noting that leaving blank lines between entries in the load file will also hamper performance.

If the output is redirected, then the splot (or plot) commands may be interspersed with the command:

            set output 'myout0001.fmt'

taking care, of course, to change the filename at each occurrence and provide a more instructive extension than fmt. At the time of writing, the filters for Compuserve GIF format were still under development, although many other graphics formats were supported already. These frames could then by chained together to make an “animated GIF” or some other similar movie format (e.g. Apple QuickTime).

Contour Plots

Contour plots may also be constructed using gnuplot. Significant speed improvements will be seen if the contour levels are fixed before the start of the animation, rather than relying on gnuplot to perform extra laborious calculations. For more information, investigate the following:

     set contour

     set cntrparam


In conclusion, gnuplot may be used for a wide variety of applications (e.g. it also understands variables and functions) and is an incredibly useful tool. The animation sequences described above (both 3D and contour plots) were constructed real time on an SGI O2 workstation – thus for many applications there is no need to export the graphics output to a file and create a movie from the output.