Credits Overview Plotting Styles Commands Terminals

Plotting

There are four gnuplot commands which actually create a plot: plot, splot, replot, and refresh. Other commands control the layout, style, and content of the plot that will eventually be created. plot generates 2D plots. splot generates 3D plots (actually 2D projections, of course). replot reexecutes the previous plot or splot command. refresh is similar to replot but it reuses any previously stored data rather than rereading data from a file or input stream.

Each time you issue one of these four commands it will redraw the screen or generate a new page of output containing all of the currently defined axes, labels, titles, and all of the various functions or data sources listed in the original plot command. If instead you need to place several complete plots next to each other on the same page, e.g. to make a panel of sub-figures or to inset a small plot inside a larger plot, use the command set multiplot to suppress generation of a new page for each plot command.

Much of the general information about plotting can be found in the discussion of plot; information specific to 3D can be found in the splot section.

plot operates in either rectangular or polar coordinates -- see set polar. splot operates in Cartesian coordinates, but will accept azimuthal or cylindrical coordinates on input. See set mapping. plot also lets you use each of the four borders -- x (bottom), x2 (top), y (left) and y2 (right) -- as an independent axis. The axes option lets you choose which pair of axes a given function or data set is plotted against. A full complement of set commands exists to give you complete control over the scales and labeling of each axis. Some commands have the name of an axis built into their names, such as set xlabel. Other commands have one or more axis names as options, such as set logscale xy. Commands and options controlling the z axis have no effect on 2D graphs.

splot can plot surfaces and contours in addition to points and/or lines. See set isosamples for information about defining the grid for a 3D function. See splot datafile for information about the requisite file structure for 3D data. For contours see set contour, set cntrlabel, and set cntrparam.

In splot, control over the scales and labels of the axes are the same as with plot except that there is also a z axis and labeling the x2 and y2 axes is possible only for pseudo-2D plots created using set view map.