colors: Various color palettes.

colorsR Documentation

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 [grDevices::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

[grDevices::cm.colors()], [grDevices::colorRampPalette()]

Examples

# 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)

SciViews documentation built on June 8, 2025, 1:52 p.m.