Description Usage Arguments Details Value References Examples
This function defines a color palette and returns a vector of colors. The palettes itself are adapted from the ColorBrewer project.
1 | colorPalette(n = NULL, type = "spectral", inv = F)
|
n |
number of colors to produce |
type |
sets the type of color palette. See Details |
inv |
revert the order of colors |
The parameter type
controls the output palette type as follows:
spectral colors from blue to red
spectral colors from green to red
MultiHue yellow - green
MultiHue yellow - green blue
MultiHue yellow - orange - brown
MultiHue yellow - orange red
red - white - blue colors
reproduces the rainbow color set
gray scale colors
gray scale colors from white to black
dark blue to dark red
HZDR cooperate design colors
HZDR cooperate design colors
If a vector of color names is supported, then a customized palette will be calculated according to these colors.
returns a vector of colors to be passed to image
or rasterImage
http://colorbrewer2.org by Cynthia A. Brewer, Geography, Pennsylvania State University
1 2 3 4 5 | # default "spectral" palette
barplot(rep(1,10), col = colorPalette(10))
# custom color palette
barplot(rep(1,10), col = colorPalette(n = 10, type = c("red","blue","yellow")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.