This is an old revision of the document!


GnuPlot

Enter gnuplot environment with 'gnuplot' command. In the interactive shell you can use the following commands.

load

To load a command file, which contains other commands for the gnuplot interactive shell. Lines starting with '#' are ignored.

load "plot_data.gnuplot"

set

  • Axes ranges
set xrange [0:1000]
set yrange [-100:100]
set x2range [0:100]
set y2range [-10:10]
set autoscale
  • Axes tics
set ytics nomirror
set y2tics -3.5,0.5,3.5
set y2tics auto
  • Axes labels
set xlabel ""
set ylabel ""
set x2label ""
set y2label ""

plot

Plot data from a file

  • With only one or two colons in the file.
plot "data.dat"
  • Specifying colons to use. If only one is specified, entry number (line number) is used for x.
plot "data.dat" using 4
plot "data.dat" using 4:5
  • Several curves in the same plot
plot "data1.dat" using 4:5, "data2.dat" using 6:7
  • Titles
plot "data1.dat" using 4:5 t "my curve"
  • Colors
show palette colornames
plot "data1.dat" using 4:5 lt rgb "red"
plot "data1.dat" using 4:5 lt rgb "#FF0000"
  • Axes : x1y1 (bottom-left), x2y2 (top-right), x1y2, x2y1
plot "data1.dat" using 4:5 axes x1y1, "data2.dat" using 6:7 axes x1y2

If you want to display different tics on y2 axis, do before the plot command:

set ytics nomirror
set y2tics -3.5,0.5,3.5
# or
set y2tics auto
  • Line type
# line
plot "data1.dat" using 4:5 with lines
# line with custom line width
plot "data1.dat" using 4:5 with lines lw 4
# points
plot "data1.dat" using 4:5 with points
# points of custom type
plot "data1.dat" using 4:5 with points pt 19
# to find out point types and line width available
test

Other possibilities

  • multiplot
  • other outputs, eg to generate eps files
software/gnuplot.1236930463.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0