gnuplot

gnuplot is a fast and powerful graphing tool.

Handy Scripts

Probably one of the most common things I want to plot is a variety of data-points over time. gnuplot can handle huge amounts of data much better than spreadsheets and the being able to zoom in and out of the interactive gnuplot graph is incredibly handy.

Here's a basic template:

# Set title and axis labels
set title "XXXTITLEXXX
set xlabel "Date (Day/Month)"
set ylabel "XXXVALUEXXX"

set key on bmargin

# To start off with let gnuplot choose the scale
set autoscale

set grid xtics noytics

# Set the x-axis (expected to be date/time)
# The timefmt sets the expected format of the input data
# The format x sets the display of the data on the x axis
set xdata time
set timefmt "%Y%m%d-%H%M"
set format x "%d/%m"

# The plotting is done with the "plot" statement, for each
# data column include a '"filename" using 1:x title "xxx" with ...'

# Every time the plot is done build a jpeg image
set term jpeg size 1280,960
set output "changes.jpg"
plot "input.data" using 1:2 title "XXXDATA_COL_1" with lines , "input.data" using 1:3 t "XXXDATA_COL_2" with his

# And then display to the gnuplot terminal (interactive plot)
set term wxt
unset output
plot "input.data" using 1:2 title "XXXDATA_COL_1" with lines , "input.data" using 1:3 t "XXXDATA_COL_2" with his

BradsWiki: GnuPlot (last edited 2010-12-18 12:20:52 by BradleyDean)