Generates a colormap of the visible color spectrum.
RAINBOW(len)
len |
- |
Optional. An integer, the colormap length. Defaults to the length of the current colormap. |
A table of RGB triples suitable for the SETCOLORMAP function.
clen = length(getcolormap());
W1: density(ravel(rep(0..(clen-1), 32), clen)');rainbow

creates a table of 32 x N (where N == colormap length) RBG values and displays the resulting colors. The resulting image is a vertical plot of colors ranging from blue (lowest) to red (highest).
W1: hsv;showcmap();
W2: rainbow;showcmap();
W3: turbo;showcmap()

W1, W2 and W3 display similar 32x256 colormaps where 256 is the colormap length.
rainbow by itself sets the colormap and shading.
a = rainbow or setcolormap(rainbow) returns the RGB values. In this case, use SETSHADING to make the new colormap take effect on an existing density or 2D plot.
The RAINBOW colormap follows a high-saturation rainbow sweep with abrupt transitions through the colors blue, cyan, green, yellow, orange, red and dark red. The gradient is not smooth in luminance.
See TURBO for a colormap similar to RAINBOW, but with intentionally smoother transitions to reduce abrupt jumps in luminance.