vcd (version 0.9-0)

rainbow_hcl: HCL and HSV Color Palettes

Description

Color palettes based on the HCL and HSV color spaces.

Usage

rainbow_hcl(n, c = 50, l = 70, start = 0, end = 360*(n-1)/n, ...)

diverge_hcl(n, h = c(260, 0), c = 100, l = c(90, 50), ...) diverge_hsv(n, h = c(2/3, 0), s = 1, v = 1, ...)

Arguments

n
the number of colors ($$\ge 1$$) to be in the palette.
c
chroma value in the HCL color description.
l
luminance value in the HCL color description.
start
the hue at which the rainbow begins.
end
the hue at which the rainbow ends.
h
hue value in the HCL or HSV color description, has to be in [0, 360] for HCL and in [0, 1] for HSV colors.
s
saturation value in the HSV color description.
v
value value in the HSV color description.
...
Other arguments passed to hcl or hsv, respectively.

Details

All three functions compute palettes based on either the HCL or the HSV color space. rainbow_hcl computes a rainbow of colors defined by different hues given a single value of each chroma and luminance. It corresponds to rainbow which computes a rainbow in HSV space. Both functions, diverge_hcl and diverge_hsv, compute a set of colors diverging from a neutral center (grey or white, without color) to two different extreme colors (blue and red by default). This is similar to cm.colors. For the diverging HSV colors, two hues h are needed, a maximal saturation s and a fixed value v. The saturation is then varied to obtain the diverging colors. For the diverging HCL colors, again two hues h are needed, a maximal chroma chroma and two luminances l. The colors are then created by linear interpolation between the full chroma and minimal luminance and a chroma of 0 and maximal luminance.

The diverging palettes are used for choosing the colors for mosaic displays in mosaic.

See Also

hcl, hsv, shadings

Examples

Run this code
pie(rep(1, 12), col = rainbow_hcl(12))
pie(rep(1, 5), col = diverge_hcl(5))
pie(rep(1, 5), col = diverge_hsv(5))

Run the code above in your browser using DataCamp Workspace