Gnuplot in a Nutshell
- plot sin(2*pi*x)
most important functions are built in.
- plot "measurement.dat"
first and second column of the file measurement.dat are taken as the
x and y values of the points to plot.
- plot [20:80][10:] "measurement.dat"
the x axis extends from 20 to 80, the y axis from 10 to a value chosen by gnuplot to present all data.
- plot "measurement.dat" using 1:3 title "second run" with linepoints
first and third column will be used, point are connected with a line,
the legend reads: second run.
- plot "measurement.dat" u 1:3 t "second run" w lp
does the same.
- plot "measurement.dat" u 0:1
the row number will be used as x-value.
- plot "measurement.dat" u 1:2:3 w yerrorbars
with y errorbars from the third column..
- plot "measurement.dat" u ($1/$4):($2*0.17)
the x-value is the ratio of the first and the fourth column,
the y-value is 0.17 times the second column.
- plot "measurement.dat" w lines linewidth 2
line is drawn with double width.
- plot "measurement.dat" , "theory.dat"
more curves to plot are separated by commas.
- f(x) = a*x**2 + b*x + c
define a fit function:
- a = 1, b = 1, c = 0
initialize fit variables with reasonable values..
- fit f(x) "measurement.dat" via a,b,c
is fit to the data in measurement.dat. The file fit.log contains
all details of the fit result..
- fit [0:10] f(x) "measurement.dat" u 1:4 via a,b,c
the fit is limited to the x-intervall 0 to 10, the y-values
are taken from the fourth column.
- save "demo.plt"
save all settings in human-readable text file.
- load "demo.plt"
read in settings, redo the plot.
- /usr/share/doc/packages/gnuplot/doc/gnuplot.html
- type help plot
-
Gnuplot - not so Frequently Asked Questions -
- C-r, C-a, C-e, tab,
,
work as in a unix-shell.
- errors? Often it's just the order of the arguments.
- non-ambiguous arguments can be abbreviated.
[ Matthias Schröter, Home ]