| tscv_pal | R Documentation |
Create a color interpolation function based on one of the predefined
tscv palettes.
tscv_pal(palette = "main", reverse = FALSE, ...)
palette |
Character value. Name of the palette. |
reverse |
Logical value. If |
... |
Additional arguments passed to
|
tscv_pal() returns a palette function created with
grDevices::colorRampPalette(). The returned function can be used to
generate any number of colors from the selected palette.
Available palettes are:
"main": blue, green, yellow.
"cool": blue, green.
"hot": yellow, orange, red.
"mixed": blue, green, yellow, orange, red.
"grey": light grey, dark grey.
A palette function that takes an integer and returns hexadecimal color codes.
Other data visualization:
plot_bar(),
plot_density(),
plot_histogram(),
plot_line(),
plot_point(),
plot_qq(),
scale_color_tscv(),
scale_fill_tscv(),
theme_tscv(),
tscv_cols()
# Create a palette function
pal <- tscv_pal("main")
# Generate five colors
pal(5)
# Reverse the palette
tscv_pal("hot", reverse = TRUE)(5)
# Use generated colors in base R
barplot(
height = c(3, 5, 4),
col = tscv_pal("main")(3)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.