colors | R Documentation |
Create vectors of 'n' contiguous colors.
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)
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. |
'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.
[grDevices::cm.colors()], [grDevices::colorRampPalette()]
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.