[ top | up ]

Color Palettes

Syntax

rainbow(n, s=1, v=1, start=0, end=(n-1)/n)
heat.colors(n)
terrain.colors(n)
topo.colors(n)

Arguments

n the number of colors to be in the palette.
s,v the ``saturation'' and ``value'' to be used to complete the HSV color descriptions.
start the (corrected) hue at which the rainbow begins.
end the (corrected) hue at which the rainbow ends.

Description

This function creates a ``rainbow'' of n colors. Equispaced hues in RGB space tend to cluster at the red, green and blue primaries.

Some applications such as contouring require a pallette of colors which do not ``wrap around'' to give a final color close to the starting one. The parameters start and end can be used to specify particular subranges of hues. The following values can be used when generating such a subrange: red=0, yellow=1/6, green=2/6, cyan=3/6, blue=4/6 and magenta=5/6.

The values returned by rainbow can be used with a col= specification in graphics functions or in par.

See Also

colors, rgb, hsv, gray, heat.colors.

Examples

# A Color Wheel piechart(rep(1,12), col=rainbow(12))