[ top | up ]

Color Rainbows

Syntax

rainbow(n, s=1, v=1, start=0, end=(n-1)/n,
        xdelta=0.07, ydelta=0.014)

Arguments

n the number of colors in the rainbow.
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.
xdelta the first correction factor.
ydelta the second correction factor.

Description

This function creates a ``rainbow'' of n colors. Equispaced hues in RGB space tend to cluster at the red, green and blue primaries. This function applies an ad-hoc correction to diminish the effect of this clustering, producing ``visually equispaced'' colors. The correction applied by rainbow was derived for a particular SVGA display and may not look right on other displays.

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

rgb, hsv, gray.

Examples

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