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]

Note that your latex file should "\usepackage{latexsym}" so that it knows about several shapes that gnuplot outputs (such as \Diamond and \Box). Try "help set term latex" for more info.

### 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 :)

### Multiple plots on a single page

Say you want to put 2 graphs on a single A4 bit of paper to print it out

set terminal postscript portrait
set size 1,1 # The documentation recommends you set to full size first
set origin 0,0
set output "output.ps"
set multiplot # Enter multiplot mode. Your prompt will become 'multiplot>'
set size 1,0.5
set origin 0,0
plot "input" using 1:2 with lines
set size 1,0.5
set origin 0,0.5
plot "input" using 1:3 with lines
unset multiplot # Exit multiplot mode

### Plotting timeseries data

set xdata time
set timefmt "%H:%M:%S"
set xrange ["8:00:00":"18:00:00"]

Timestamps in your data file will now be recognised. Gaps in your time data will show up as gaps in the graph.

### Normal distribution

Define the following:

invsqrt2pi=1.0/sqrt(2.0*pi)
normal(x,mu,sigma)=invsqrt2pi/sigma*exp(-0.5*((x-mu)/sigma)**2)

Now, if you want a normal distribution with mean 13 and SD 1, you can go

plot normal(x,13,1)

### Force a scale

set xrange[0:10]
set yrange[50:100]