primary.colors | R Documentation |
Combines red, green and blue values to create primary colors
primary.colors(n, steps = 3, no.white = TRUE)
n |
number of colors to generate (optional) |
steps |
number of rgb intensity levels |
no.white |
boolean indicating whether to return white |
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.
An R color palette
Timothy H. Keitt
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.