Syntax:
set dgrid3d {<row_size>} {,{<col_size>} {,<norm>}} unset dgrid3d show dgrid3d
By default dgrid3d is disabled. When enabled, 3-d data read from a file are always treated as a scattered data set. A grid with dimensions derived from a bounding box of the scattered data and size as specified by the row/col_size parameters is created for plotting and contouring. The grid is equally spaced in x (rows) and in y (columns); the z values are computed as weighted averages of the scattered points' z values.
The third parameter, norm, controls the weighting: Each data point is
weighted inversely by its distance from the grid point raised to the norm
power. (Actually, the weights are given by the inverse of dx^
norm + dy^
norm,
where dx and dy are the components of the separation of the grid point from
each data point. For some norms that are powers of two, specifically 4, 8,
and 16, the computation is optimized by using the Euclidean distance in the
weight calculation, (dx^
2+dy^
2)^
norm/2. However, any non-negative integer
can be used.)
The closer the data point is to a grid point, the more effect it has on that grid point and the larger the value of norm the less effect more distant data points have on that grid point.
The dgrid3d option is a simple low pass filter that converts scattered data to a grid data set. More sophisticated approaches to this problem exist and should be used to preprocess the data outside gnuplot if this simple solution is found inadequate.
(The z values are found by weighting all data points, not by interpolating between nearby data points; also edge effects may produce unexpected and/or undesired results. In some cases, small norm values produce a grid point reflecting the average of distant data points rather than a local average, while large values of norm may produce "steps" with several grid points having the same value as the closest data point, rather than making a smooth transition between adjacent data points. Some areas of a grid may be filled by extrapolation, to an arbitrary boundary condition. The variables are not normalized; consequently the units used for x and y will affect the relative weights of points in the x and y directions.)
Examples:
set dgrid3d 10,10,1 # defaults set dgrid3d ,,4
The first specifies that a grid of size 10 by 10 is to be constructed using a norm value of 1 in the weight computation. The second only modifies the norm, changing it to 4. See also
http://www.gnuplot.info/demo/scatter.htmlscatter.dem: dgrid3d demo.