14.10.2014 Views

gnuplot documentation

gnuplot documentation

gnuplot documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

72 SPLOT <strong>gnuplot</strong> 4.3 153<br />

allows to transform the axes coordinates and the z-data independently.<br />

Usage in plot:<br />

plot ‘a.dat‘ matrix<br />

plot ‘a.dat‘ matrix using 1:3<br />

plot ’a.gpbin’ {matrix} binary using 1:3<br />

will plot rows of the matrix, while using 2:3 will plot matrix columns, and using 1:2 the point coordinates<br />

(rather useless). Applying the every option you can specify explicit rows and columns.<br />

Example – rescale axes of a matrix in an ascii file:<br />

splot ‘a.dat‘ matrix using (1+$1):(1+$2*10):3<br />

Example – plot the 3rd row of a matrix in an ascii file:<br />

plot ’a.dat’ matrix using 1:3 every 1:999:1:2<br />

(rows are enumerated from 0, thus 2 instead of 3).<br />

72.2 Grid data<br />

The 3D routines are designed for points in a grid format, with one sample, datapoint, at each mesh intersection;<br />

the datapoints may originate from either evaluating a function, see set isosamples (p. 105), or<br />

reading a datafile, see splot datafile (p. 150). The term "isoline" is applied to the mesh lines for both<br />

functions and data. Note that the mesh need not be rectangular in x and y, as it may be parameterized<br />

in u and v, see set isosamples (p. 105).<br />

However, <strong>gnuplot</strong> does not require that format. In the case of functions, ’samples’ need not be equal to<br />

’isosamples’, i.e., not every x-isoline sample need intersect a y-isoline. In the case of data files, if there<br />

are an equal number of scattered data points in each datablock, then "isolines" will connect the points<br />

in a datablock, and "cross-isolines" will connect the corresponding points in each datablock to generate<br />

a "surface". In either case, contour and hidden3d modes may give different plots than if the points were<br />

in the intended format. Scattered data can be converted to a {different} grid format with set dgrid3d.<br />

The contour code tests for z intensity along a line between a point on a y-isoline and the corresponding<br />

point in the next y-isoline. Thus a splot contour of a surface with samples on the x-isolines that do not<br />

coincide with a y-isoline intersection will ignore such samples. Try:<br />

set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2]<br />

set style function lp<br />

set contour<br />

set isosamples 10,10; set samples 10,10;<br />

splot cos(x)*cos(y)<br />

set samples 4,10; replot<br />

set samples 10,4; replot<br />

72.3 Splot overview<br />

splot can display a surface as a collection of points, or by connecting those points. As with plot, the<br />

points may be read from a data file or result from evaluation of a function at specified intervals, see set<br />

isosamples (p. 105). The surface may be approximated by connecting the points with straight line<br />

segments, see set surface (p. 134), in which case the surface can be made opaque with set hidden3d.<br />

The orientation from which the 3d surface is viewed can be changed with set view.<br />

Additionally, for points in a grid format, splot can interpolate points having a common amplitude (see<br />

set contour (p. 94)) and can then connect those new points to display contour lines, either directly<br />

with straight-line segments or smoothed lines (see set cntrparam (p. 92)). Functions are already<br />

evaluated in a grid format, determined by set isosamples and set samples, while file data must either<br />

be in a grid format, as described in data-file, or be used to generate a grid (see set dgrid3d (p. 97)).<br />

Contour lines may be displayed either on the surface or projected onto the base. The base projections<br />

of the contour lines may be written to a file, and then read with plot, to take advantage of plot’s<br />

additional formatting capabilities.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!