generates expanded sets of primary colors
Description
Combines red, green and blue values to create primary colors
Usage
primary.colors(n, steps = 3, no.white = TRUE)
primary.colors(n, steps = 3, no.white = TRUE)
Arguments
n |
number of colors to generate (optional) |
steps |
number of rgb intensity levels |
no.white |
boolean indicating whether to return white |
Details
The standard R palette only provides 8 colors after which colors are recycled. If you need a few more colors that are redily distinguished in multivariate plots, this function can help.
Value
An R color palette
Author(s)
Timothy H. Keitt
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
Examples
x <- matrix(rnorm(100), 10) x <- sapply(1:10, function(i, x) cumsum(x[,i]), x=x) par(mfrow = c(1, 2)) matplot(1:10, x, type = 'l', lty = 1, lwd = 3) matplot(1:10, x, type = 'l', lty = 1, lwd = 3, col = primary.colors(10))
x <- matrix(rnorm(100), 10) x <- sapply(1:10, function(i, x) cumsum(x[,i]), x=x) par(mfrow = c(1, 2)) matplot(1:10, x, type = 'l', lty = 1, lwd = 3) matplot(1:10, x, type = 'l', lty = 1, lwd = 3, col = primary.colors(10))