Simple XY plot with gnuplot

I can never remember the code to do a simple xy plot in gnuplot. So here it is:

set size square

set ylabel "Population"
set xlabel "Distance"

set terminal postscript eps color
set output "plot.eps"
plot "data" using 1:2 with lines

Plots an eps file called plot.eps from a file called data. data contains 2 columns, the first is the x axis the second the y.

Change lines to points to get a scatter graph.

  • GnuPlot Man

    #1 Google Hit for “gnuplot simple x y plot”. Good job!

    Thanks for your contribution to the world of people who love gnuplot but think the documentation is horrific.