Among the scores of graphic packages available, gnuplot
stands out
for its power and ease of use. Go to X and type gnuplot
, and have
two sample data files ready: 2D-data.dat
(two data per line), and
3D-data.dat
(three data per line).
Examples of 2-D graphs:
gnuplot> set title "my first graph"
gnuplot> plot '2D-data.dat'
gnuplot> plot '2D-data.dat' with linespoints
gnuplot> plot '2D-data.dat', sin(x)
gnuplot> plot [-5:10] '2D-data.dat'
Example of 3-D graphs (each `row' of X values is followed by a blank line):
gnuplot> set parametric ; set hidden3d ; set contour
gnuplot> splot '3D-data.dat' using 1:2:3 with linespoints
A single-column datafile (e.g., a time series) can also be plotted as a 2-D graph:
gnuplot> plot [-5:15] '2D-data-1col.dat' with linespoints
or as a 3-D graph (blank lines in the datafile, as above):
gnuplot> set noparametric ; set hidden3d
gnuplot> splot '3D-data-1col.dat' using 1 with linespoints
To print a graph: if the command to print on your Postscript printer is
lpr -Pps file.ps
, issue:
gnuplot> set term post
gnuplot> set out '| lpr -Pps'
gnuplot> replot
then type set term x11
to restore. Don't get confused---the last print
will be done only when you quit gnuplot
.
For more info, type help
or see the examples in directory
/usr/lib/gnuplot/demos/
, if you have it.