(Updated 2000 Mar 24)
gnuplot
a plotting program
The basics:
Below I've shortened some of what's found in the real Gnuplot user's guide. Here is the full, PostScript version, which I would recommend viewing at 150% in size.
The up and down arrows navigate between prior commands.
One can make 3D plots, but I haven't looked into them, and I may or may not do so in the future.
Run gnuplot by typing:
gnuplot
The syntax for plotting something is of the form:
gnuplot> plot cos(x)
Plotting additional functions simultaneously is accomplished with commas:
gnuplot> plot cos(x),sin(x**2),cos(exp(x))
One can specify an x-range with leading square brackets and a colon:
gnuplot> plot [-pi:pi] sin(x**2),cos(exp(x))
Y-ranges can be specified with a second pair of square brackets:
gnuplot> plot [] [0:2] 1/(1+x**2)
One can specify the x-range outside of a 'plot' command. (Setting the y-range is analogous):
gnuplot> set xrange [-.3:3.5]
One can add labels to a plot:
gnuplot> set ylabel "POWER FUNCTION"
gnuplot> replot
One can plot from columns of data in a text file. The filename is framed in single quotes, and the columns corresponding to the x- and y-axes are designated following the word 'using'. I think only one line at the top is accepted as a column header.
gnuplot> plot [0:0.5] 'avg-near.bigg' using 1:2
The command above will produce a scatterplot. Connect-the-dots is accomplished with the phrase 'with lines':
gnuplot> plot [0:0.5] 'avg-near.bigg' using 1:2 with lines
One outputs to a postscript file by setting the output to postscript, specifying a filename, executing a plot command, and returning to X-window output:
gnuplot> set term postscript
gnuplot> set output 'amps.ps'
gnuplot> replot
gnuplot> set term x11
Gnuplot can be used as a calculator by using the 'print' command:
gnuplot> print 1/4
0.25
One can write a script as a text file containing commands as one would type from within gnuplot. To run the script from within gnuplot type:
gnuplot> load 'script.txt'
This page is Lynx-enhanced.