Simple XY plot with gnuplot

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

1
2
3
4
5
6
7
8
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.

One Comment

  1. GnuPlot Man says:

    #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.

Leave a Reply