| as.colorRampPalette | R Documentation |
Create a function that interpolates a set of colors to produce new color palettes.
as.colorRampPalette(...)
... |
arguments to pass to |
This is a preferable alternative to colorRampPalette since the
returned function has more arguments. The returned function has arguments
start, end, alpha, and rev, similar to
rainbow or viridis.colors.
If only one argument is provided that happens to be a function, it is assumed
that this function is the function that maps the interval [0,1] to a series
of colors, and so the argument will not be passed to colorRamp.
A function which takes an integer n and returns a character vector of
n colors.
crp <- as.colorRampPalette(1:9)
show.colors(crp(20))
show.colors(crp(20, end = 19/20))
show.colors(crp(20, alpha = 0.75))
show.colors(crp(20, rev = TRUE))
show.colors(crp(20, end = 19/20, alpha = 0.75, rev = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.