## convenience demo function
wheel <- function(col, radius = 1, ...)
pie(rep(1, length(col)), col = col, radius = radius, ...)
## compare base and colorspace palettes
## (in color and desaturated)
par(mar = rep(0, 4), mfrow = c(2, 2))
## rainbow color wheel
wheel(rainbow_hcl(12))
wheel(rainbow(12))
wheel(desaturate(rainbow_hcl(12)))
wheel(desaturate(rainbow(12)))
## diverging red-blue colors
swatchplot(
diverging_hsv(7),
desaturate(diverging_hsv(7)),
diverging_hcl(7, c = 100, l = c(50, 90)),
desaturate(diverging_hcl(7, c = 100, l = c(50, 90))),
nrow = 2
)
## diverging cyan-magenta colors
swatchplot(
cm.colors(7),
desaturate(cm.colors(7)),
diverging_hcl(7, "Cyan-Magenta"), ## or, similarly: Tropic
desaturate(diverging_hcl(7, "Cyan-Magenta")),
nrow = 2
)
## heat colors
swatchplot(
heat.colors(12),
desaturate(heat.colors(12)),
heat_hcl(12),
desaturate(heat_hcl(12)),
nrow = 2
)
## terrain colors
swatchplot(
terrain.colors(12),
desaturate(terrain.colors(12)),
terrain_hcl(12),
desaturate(terrain_hcl(12)),
nrow = 2
)
Run the code above in your browser using DataLab