The PLplot Plotting Library: Programmer's Reference Manual
Prev | Chapter 17. The Common API for PLplot | Next

### `plscmap1l`: Set color map1 colors using a piece-wise linear relationship

`plscmap1l` (itype, npts, pos, coord1, coord2, coord3, rev);

Set color map1 colors using a piece-wise linear relationship between position in the color map (from 0 to 1) and position in HLS or RGB color space (see the Section called Color Map1 in Chapter 3). May be called at any time.

The idea here is to specify a number of control points that define the mapping between palette 1 input positions (intensities) and HLS (or RGB). Between these points, linear interpolation is used which gives a smooth variation of color with input position. Any number of control points may be specified, located at arbitrary positions, although typically 2 - 4 are enough. Another way of stating this is that we are traversing a given number of lines through HLS (or RGB) space as we move through color map1 entries. The control points at the minimum and maximum position (0 and 1) must always be specified. By adding more control points you can get more variation. One good technique for plotting functions that vary about some expected average is to use an additional 2 control points in the center (position ~= 0.5) that are the same lightness as the background (typically white for paper output, black for crt), and same hue as the boundary control points. This allows the highs and lows to be very easily distinguished.

Each control point must specify the position in color map1 as well as three coordinates in HLS or RGB space. The first point must correspond to position = 0, and the last to position = 1.

The hue is interpolated around the "front" of the color wheel (red<->green<->blue<->red) unless the "rev" flag is set to true, in which case interpolation (between the `i` and `i + 1` control point for `rev[i]`) proceeds around the back (reverse) side. Specifying rev=NULL is equivalent to setting rev[]= false for every control point.

Table 17-1. Bounds on coordinates

RGB | R | [0, 1] | magnitude
RGB | G | [0, 1] | magnitude
RGB | B | [0, 1] | magnitude
HLS | hue | [0, 360] | degrees
HLS | lightness | [0, 1] | magnitude
HLS | saturation | [0, 1] | magnitude

`itype` (`PLBOOL`, input) true: RGB, false: HLS. `npts` (`PLINT`, input) number of control points `pos` (`PLFLT *`, input) position for each control point (between 0.0 and 1.0, in ascending order) `coord1` (`PLFLT *`, input) first coordinate (H or R) for each control point `coord2` (`PLFLT *`, input) second coordinate (L or G) for each control point `coord3` (`PLFLT *`, input) third coordinate (S or B) for each control point `rev` (`PLBOOL: *`, input) reverse flag for each control point. (`rev[i]` refers to the interpolation interval between the `i` and `i + 1` control points).

Prev | Home | Next
`plscmap1`: Set color map1 colors using 8-bit RGB values | Up | `plscmap1n`: Set number of colors in color map1