Chapter 7. Gnuplot

Plotting can be done with gnuplot which is best started from the shell:

$ gnuplot

Try the following sequnce of commands that work on "datafile" created by firstprog in the previous chapter:

gnuplot> plot 'datafile'

gnuplot> plot 'datafile' with linespoints

gnuplot> plot 'datafile', 'datafile' using 1:3

gnuplot> plot 'datafile', sin(x), 'datafile' using 1:3, sin(x/3)

It could seem strange but there is no simple command for writing the figure to the file or to a printer. One actually needs several commands and the common solution is therefore to put things in a file and then load or call that file to perform the desired actions.

gnuplot> call '/home/local/print.gp' file

writes the (encapsulated postscript) figure to the file file.ps (where ps stands for postscript).

Help is available with the command help. For further information se the gnuplot tutorial.