8.12 Color maps
Color maps provide a graphical means of producing two-dimensional representations of surfaces, or equivalently of producing maps of the values of functions of two variables. Each point in the plane is assigned a color which indicates the value associated with that point. In this section, we refer to the third coordinate as rather than , to distinguish it from the third axes of three-dimensional plots1.
In the following simple example, a color map of the complex argument of the Riemann zeta function is produced, taking the plane to be an Argand plane, with being the real axis, and being the imaginary axis. Each point in the plane has an associated value of .
set numerics complex
The set samples grid command sets the dimensions of the grid of samples – or pixels – used to render the color map. If either value is replaced with an asterisk (*) then the current number of samples set in the set samples command is substituted.
If a data file is supplied to the colormap plot style, then the datapoints need not lie on the specified regular grid, but are first re-sampled onto this grid using the interpolation method specified using the set samples interpolate command (see Section 5.7). Three methods are available. nearestNeighbor uses the value of associated with the datapoint closest to each grid point, producing color maps which look like Voronoi diagrams. inverseSquare interpolation returns a weighted average of the supplied data points, using the inverse squares of their distances from each grid point as weights. monaghanLattanzio interpolation uses the weighting function of Monaghan & Lattanzio (1985) which is described further in Section 5.7).
In the following example, a color map of a quadrupole is produced using four input datapoints: