The following is a tutorial on how to use gnuplot to generate some simple graphs. It is assumed you have a datafile with output in the following format:
0 3 1 4 2 5 3 6 4 9 5 10 6 12 7 18 8 22 0 32 1 41 2 51 3 64 4 96 5 102 6 123 7 181 8 221 |
To run gnuplot, simply type gnuplot at the prompt. You will be presented with a gnuplot> prompt. This is where you issue commands to gnuplot. At any time, you can ask gnuplot for help by typing help at the prompt.
For your first assignment, these commands will suffice:
gnuplot> set output "graph.ps"
gnuplot> set terminal postscript
gnuplot will respond something like "Options are..."
gnuplot> plot "datafile" with lines
The first line sets the output file name to graph.ps. Use ghostview to view and print this file.
The next line sets the format of the output to postscript, which you can send to the printer on the first floor (provided you've bought paper for it)
The last line actually does the plotting, and saves it to the file. Using
the data above, the graph looks like this:
gnuplot will run these commands if you tell it to:set output "mygraph.ps" set terminal postscript plot "datafile" withlines
huizing@cse% gnuplot script
If you receive some X11 error, there's probably a problem with your .login file. Move it elsewhere, and re-login.