01.02.2014 Views

GNUPlot Manual

GNUPlot Manual

GNUPlot Manual

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.

38 SPLOT gnuplot 4.0 157<br />

Note that "datafile.dat" defines a 4 by 3 grid ( 4 rows of 3 points each ). Rows (datablocks) are separated<br />

by blank records.<br />

Note also that the x value is held constant within each dataline. If you instead keep y constant, and<br />

plot with hidden-line removal enabled, you will find that the surface is drawn ’inside-out’.<br />

Actually for grid data it is not necessary to keep the x values constant within a datablock, nor is it<br />

necessary to keep the same sequence of y values. gnuplot requires only that the number of points be<br />

the same for each datablock. However since the surface mesh, from which contours are derived, connects<br />

sequentially corresponding points, the effect of an irregular grid on a surface plot is unpredictable and<br />

should be examined on a case-by-case basis.<br />

38.1.3 Matrix<br />

The matrix flag indicates that the ASCII data are stored in matrix format. The z-values are read in a<br />

row at a time, i. e.,<br />

z11 z12 z13 z14 ...<br />

z21 z22 z23 z24 ...<br />

z31 z32 z33 z34 ...<br />

and so forth. The row and column indices are used for the x- and y-values.<br />

A blank line or comment line ends the matrix, and starts a new surface mesh. You can select among<br />

the meshes inside a file by the index option to the splot command, as usual.<br />

38.2 Grid data<br />

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

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

or reading a datafile, see splot datafile (p. 155). 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. 71).<br />

However, gnuplot 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 />

38.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<br />

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

segments, see set surface (p. 99), 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.

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

Saved successfully!

Ooh no, something went wrong!