The colour mapping used by the colourmap plot style is set using the set colourmap command, which takes algebraic expressions for the RGB, HSB or CMYK components of the colour to use as a function of the variables c1, c2, c3 and c4. As elsewhere in PyXPlot, these colour components should take values in the range zero to one; values outside of this range are clipped. The syntax of the set colourmap command is as follows:
set colourmap ( rgb<r>:<g>:<b> | hsb<h>:<s>:<b> | cmyk<c>:<m>:<y>:<k> ) [ mask <expr> ]
If the optional mask expression is supplied, then any areas in a colour map where this expression evaluates to zero (i.e. false) are made transparent. The following colour mapping, which is the default, produces a greyscale colour mapping of the third column of data supplied to the colourmap plot style; further columns of data, if supplied, are not used:
set c1range [*:*] renormalise noreverse set colourmap rgb(c1):(c1):(c1)
The set c<n>range command command specifies how the values of are processed before being used in the expressions supplied to the set colourmap command. It has the following syntax:
set c<n>range [ <range> ] [ reversed | noreversed ] [ renormalise | norenormalise ]
If the renormalise option is specified, then the values of at each point in the data grid are first scaled into the range zero to one. This is generally useful, since the colour components themselves must be in this range; in the example given above, the lowest value of
corresponds to black (i.e. brightness 0), and the highest value corresponds to white (i.e. brightness 1). If an explicit range is specified to the set c<n>range command, then the upper limit of this range maps to the value one, and the lower limit maps to the value zero. An asterisk (*) means that the lowest or highest value is substituted. The mapping is inverted if the reverse option is specified, such that the upper limit maps to zero, and the lower limit maps to one. Intermediate values are scaled either linearly or logarithmically, and these behaviours can be selected with the following commands:
set logscale c1 set linearscale c1
In the example below, a colour map of the function is made, using hue to represent the magnitude of
and saturation to represent the complex argument of
:
set numerics complex
set sample grid 400x400
set nogrid
set size square
set key below
set c1range[0:2]
set colmap hsb(c1):(c2*0.7+0.3):1
f(x) = 3*x**2 / (x**3+1)
plot [-3:3][-3:3] abs(f(x+i*y)):arg(f(x+i*y)) with colourmap