View source: R/rainbowPalette.R
rainbowPalette | R Documentation |
This function returns a perceptually optimised rainbow color palette.
rainbowPalette(n)
n |
the number of colours to be returned |
a vector of colours
pal <- function(col, border = "transparent", ...) {
n <- length(col)
plot(0, 0, type="n", xlim = c(0, 1), ylim = c(0, 1),
axes = FALSE, xlab = "", ylab = "", ...)
rect(0:(n-1)/n, 0, 1:n/n, 1, col = col, border = border)
} # courtesy Paul Murrell
pal(rainbowPalette(1000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.