Learn R Programming

SciViews (version 0.9-13.1)

colors: Various color palettes.

Description

Create vectors of n contiguous colors.

Usage

rwb_colors(n, alpha = 1, s = 0.9, v = 0.9)

rwb.colors(n, alpha = 1, s = 0.9, v = 0.9)

rwg_colors(n, alpha = 1, s = 0.9, v = 0.9)

rwg.colors(n, alpha = 1, s = 0.9, v = 0.9)

ryg_colors(n, alpha = 1, s = 0.9, v = 0.9)

ryg.colors(n, alpha = 1, s = 0.9, v = 0.9)

cwm_colors(n, alpha = 1, s = 0.9, v = 0.9)

cwm.colors(n, alpha = 1, s = 0.9, v = 0.9)

Arguments

n

The number of colors (>= 1) to be in the palette.

alpha

The alpha transparency, a number in [0, 1], see argument alpha = in [hsv()].

[0, 1]: R:0, [hsv()]: R:hsv()

s

The 'saturation' to be used to complete the HSV color descriptions.

v

The 'value' to use for the HSV color descriptions.

Details

cwm_colors(s = 0.5, v = 1) gives very similar colors to cm.colors(). ryg_colors() is similar to rainbow(start = 0, end = 2/6). The xxx_colors() (tidyverse name-compatible) and `xxx.colors()`` (grDevices name-compatible) functions are synonyms.

See Also

cm.colors(), colorRampPalette()

Examples

Run this code
# NOT RUN {
# Draw color wheels with various palettes
opar <- par(mfrow = c(2, 2))
pie(rep(1, 11), col = cwm.colors(11), main = "Cyan - white - magenta")
pie(rep(1, 11), col = rwb.colors(11), main = "Red - white - blue")
pie(rep(1, 11), col = rwg.colors(11), main = "Red - white - green")
pie(rep(1, 11), col = ryg.colors(11), main = "Red - yellow - green")
par(opar)
# }

Run the code above in your browser using DataLab