Penguin
Note: You are viewing an old revision of this page. View the current version.

The old-school Unix way of generating graphs from numeric data. It has very verbose documentation, but unfortunately it lacks in practical examples.

Hints

Output format

By default, gnuplot creates X11 windows and draws the graphs to your XServer. But that's no good for embedding it into a report, so do:

set output "filename.ps"
set term postscript color
[...]
plot [your plot command]

If you use LaTeX, you can get gnuplot to output a LaTeX picture instead of embedding a graphic in your report:

set output "foo.tex"
set term latex
[...]
plot [your plot command]

Vertical Lines

The default is to give a function that calculates "y" for various values of "x", but that makes it difficult to get a vertical line. Do

set parametric
# vertical line
plot 0, t
# horizontal
plot t, 0
# or just plain old
plot 5

Multiple columns from the same data file

set pointsize 2
# plot [xrange] [yrange] function, function, ....
# do columns 3,4 and 6, using the first column for x
plot [0:2] [0:100] "input" using 1:3 with linespoints title "3rd", \
  "input" u 1:4 w lp t "4th", "input" u 1:6 w lp t "6th"

As you see, command names can be shortened, which can make it hard to understand what is happening :)