rainbow_hcl {vcd} | R Documentation

## 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 ( >= 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 neutral color (with zero chroma and luminance `l[1]`) and the full color (with chroma `c` and luminance `l[2]`).

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

### Author(s)

Achim Zeileis Achim.Zeileis@R-project.org

### See Also

`hcl`, `hsv`, `shadings`

### Examples

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

    ## a few useful diverging HCL palettes
    pie(rep(1, 7), col = diverge_hcl(7))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(246, 40), c = 96, l = c(90, 65)))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(130, 43), c = 100, l = c(90, 70)))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(180, 70), c = 70, l = c(95, 90)))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(180, 330), c = 59, l = c(95, 75)))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(128, 330), c = 98, l = c(90, 65)))
    pie(rep(1, 7), col = diverge_hcl(7, h = c(255, 330)))

[Package vcd version 0.9-6 Index]