cpal | R Documentation |
These functions provide simple color palettes.
## Continuous color palettes
cpal(palette = "Viridis")
## Discrete color palettes
dpal(palette = "Tableau 10")
## List palettes
cpals()
dpals()
# Add transparency to colors
add_alpha(colors, alpha = 1, pow = 1)
palette |
The name of a color palette. See |
colors |
A character vector of colors to add transparency to. |
alpha |
A numeric vector giving the level of transparency in the range [0, 1] where 0 is fully transparent and 1 is fully opaque. |
pow |
The power scaling of the alpha channel. A linear alpha scale often results in poor interpretability for superposed images, so raising the alpha channel (already in range [0, 1]) to a power > 1 can improve interpretability in these cases. Conversely, for highly skewed data, using a power < 1 can reduce the impact of extreme values. |
A character vector of colors or a function for generating n
colors.
Kylie A. Bemis
vizi
,
image
f <- cpal("viridis")
cols <- f(10)
add_alpha(cols, 1:10/10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.