This is an old revision of the document!
Table of Contents
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 ""
- Graph title
set title ""
- Multiplot
set multiplot set size 0.5,1.0 set origin 0,0 plot <...> set size 0.5,1.0 set origin 0.5,0 plot <...> unset multiplot
- New plot window
plot <...> set term wxt 1 plot <...> set term wxt 2 plot <...>
- Clear window
clear
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
- Functions 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
- other outputs, eg to generate eps files