ChartColors | R Documentation |
Generates a vector of colors from a palette or vector of colors. Alpha channels are ignored and set to 255/FF.
ChartColors(
number.colors.needed,
given.colors,
reverse = FALSE,
palette.start = 0,
palette.end = 1,
trim.light.colors = TRUE,
custom.color = NA,
custom.gradient.start = NA,
custom.gradient.end = NA,
custom.palette = NA,
silent = FALSE,
silent.single.color = silent
)
number.colors.needed |
The number of colors to generate. |
given.colors |
Specifies the color vector to output. It can be;
(1) A named palette from grDevices, RColorBrewer colorspace, or colorRamps;
(2) A vector of colors which will be recycled to length |
reverse |
Whether the output color vector should be reversed. Ignored when |
palette.start |
A numeric in [0,1] specifying the start of the palette relative to the full spectrum
of |
palette.end |
A numeric in [0,1] specifying the end of the palette relative to the full spectrum
of |
trim.light.colors |
When selected, palette.start and palette.end will be set to remove light colors in the
monochrome palettes ( |
custom.color |
A single color provided as a hex or character string. Only used if |
custom.gradient.start |
A color specifying the start of the gradient when |
custom.gradient.end |
A color specifying the end of the gradient when |
custom.palette |
A vector or comma separated list of colors which will be recycled to the desired length.
Only used if |
silent |
Option to hide warnings about the number of colors. |
silent.single.color |
Option to hide warnings if only a single color is provided when
|
ChartColors(5, given.colors = c("blue", "orange", "green"))
ChartColors(5, given.colors = "blue")
ChartColors(5, given.colors = "#9CFF73")
ChartColors(5, given.colors = "Set3", reverse = TRUE)
plot(1:10,1:10,pch=19, col=ChartColors(10,"Reds",trim.light.colors=TRUE, reverse=TRUE))
plot(1:12, 1:12, pch=19, col=ChartColors(12))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.