Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR02 / Books / gnuplot 4.6 manual.pdf
Скачиваний:
59
Добавлен:
18.03.2015
Размер:
2.22 Mб
Скачать

170

gnuplot 4.6

Example data le

A simple example of plotting a 3D data le is splot 'datafile.dat'

where the le "data le.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 "data le.dat" de nes a 4 by 3 grid ( 4 rows of 3 points each ). Rows (datablocks) 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 nd that the surface is drawn 'inside-out'.

Actually for grid data it is not necessary to keep the x values constant within a datablock, 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 datablock. However since the surface mesh, from which contours are derived, connects sequentially corresponding points, the e ect of an irregular grid on a surface plot is unpredictable and should be examined on a case-by-case basis.

Grid data

The 3D routines are designed for points in a grid format, with one sample, datapoint, at each mesh intersection; the datapoints may originate from either evaluating a function, see set isosamples (p. 117), or reading a data le, see splot data le (p. 168). The term "isoline" is applied to the mesh lines for both functions and data. Note that the mesh need not be rectangular in x and y, as it may be parameterized in u and v, see set isosamples (p. 117).

However, gnuplot does not require that format. In the case of functions, 'samples' need not be equal to 'isosamples', i.e., not every x-isoline sample need intersect a y-isoline. In the case of data les, if there are an equal number of scattered data points in each datablock, then "isolines" will connect the points in a datablock, and "cross-isolines" will connect the corresponding points in each datablock to generate a "surface". In either case, contour and hidden3d modes may give di erent plots than if the points were in the intended format. Scattered data can be converted to a fdi erentg grid format with set dgrid3d.

The contour code tests for z intensity along a line between a point on a y-isoline and the corresponding point in the next y-isoline. Thus a splot contour of a surface with samples on the x-isolines that do not coincide with a y-isoline intersection will ignore such samples. Try:

set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2] set style function lp

set contour

set isosamples 10,10; set samples 10,10; splot cos(x)*cos(y)

set samples 4,10; replot set samples 10,4; replot

Соседние файлы в папке Books