Credits | Overview | Plotting Styles | Commands | Terminals |
---|
A simple example of plotting a 3D data file is
splot 'datafile.dat'
where the file "datafile.dat" might contain:
# The valley of the Gnu. 0 0 10 0 1 10 0 2 10
1 0 10 1 1 5 1 2 10
2 0 10 2 1 1 2 2 10
3 0 10 3 1 0 3 2 10
Note that "datafile.dat" defines a 4 by 3 grid ( 4 rows of 3 points each ). Rows (blocks) are separated by blank records.
Note also that the x value is held constant within each dataline. If you instead keep y constant, and plot with hidden-line removal enabled, you will find that the surface is drawn 'inside-out'.
Actually for grid data it is not necessary to keep the x values constant within a block, nor is it necessary to keep the same sequence of y values. gnuplot requires only that the number of points be the same for each block. However since the surface mesh, from which contours are derived, connects sequentially corresponding points, the effect of an irregular grid on a surface plot is unpredictable and should be examined on a case-by-case basis.