Making Three-dimensional Plots

The 3-D plotting command in gnuplot is called splot. It has many features in common with plot. You can plot a 2-D function z(x,y) as a surface in 3-D space just by typing something like
	splot [-5:5] [0:10] x * sin(x) * cos(sqrt(y))
where the square brackets specify the plotting range in x and y.

Some useful commands for use with splot are

set contour <option>
Draw contour lines, on the base of the diagram (option = base), on the 3-D surface itself (option = surface), or on both (option = both). Turn contours off with set nocontour.   Default: no contours.

set [no]hidden3d
Hide [don't hide] invisible lines.   Default: don't hide.

set isosamples <resolution>
Change the resolution of the 3-D plot.   Default is 10, which is low; 30 is better.

set [no]surface
Show [don't show] the 3-D surface. Handy when you just want the contour plot.

set view horiz_angle,vert_angle,zoom
Set the viewing direction and magnification of the graph. The horiz_angle measures angle away from the z-axis of the plot. The vert_angle measures angle around the z-axis. Setting zoom greater than 1 moves the observer closer to the plot.   Defaults are 60,30,1.

With just a file name as an argument, splot draws the 3-D trajectory (x, y, z) with x taken from the first columnn of the file, y from the second, and z from the third:

 splot "my-3d-data-file"

A more complete splot command might look like

	splot [x-range] [y-range] [z-range]		\
		"my-3d-data-file"			\
			every sampling-interval		\
			using column-list		\
		with points-or-lines
The terminology is the same as for plot, except that column-list is now xcol:ycol:zcol, with default 1:2:3.

EXAMPLE:   splot 'data4' every 3 with points