Whilst xmgrace has a graphical user interface, and so is relatively easy to start with, gnuplot has a command-line interface so can be a bit trickier. To plot the data in file phil.dat
gnuplot> plot 'phil.dat'
Each datum is a small diamond, but it's often easier to join them with lines as well.
gnuplot> plot 'phil.dat' with linespoints
By default gnuplot will use the first column of the file as the x data, and second column as the y. We can tell it which columns to use
gnuplot> plot 'phil.dat' using 3:2 with linespoints
One of the more useful features of gnuplot is that it will do function fitting and plotting.
gnuplot> f(x) = a + b*x gnuplot> fit f(x) 'phil.dat' using 1:2 via a,b
The function f(x) is fitted to the data in columns 1 and 2 of phil.dat by varying the parameters a and b. The fitting is an iterative process, and at the end you will see
a = 24.0778 b = 12.2008 After 4 iterations the fit converged. final sum of squares of residuals : 37.9648 rel. change during last iteration : -2.76273e-09 degrees of freedom (ndf) : 3 rms of residuals (stdfit) = sqrt(WSSR/ndf) : 3.55738 variance of residuals (reduced chisquare) = WSSR/ndf : 12.6549 Final set of parameters Asymptotic Standard Error ======================= ========================== a = 24.0778 +/- 2.371 (9.848%) b = 12.2008 +/- 0.6064 (4.97%) correlation matrix of the fit parameters: a b a 1.000 b -0.742 1.000
Of course we probably want to plot this.
gnuplot> plot f(x), 'phil.dat' using 1:2
The scales are a bit large, but we can change those as well
gnuplot> plot [0:3] f(x), 'phil.dat' using 1:2
There are many more commands, and you can type help at the gnuplot prompt to find out more.