View source: R/palette-registry.R
get_palette | R Documentation |
The scales packages keeps track of a set of palettes it considers 'known'.
The benefit of a known palette is that it can be called by name in functions
as as_continuous_pal()
or as_discrete_pal()
.
get_palette(name, ...)
set_palette(name, palette, warn_conflict = TRUE)
palette_names()
reset_palettes()
name |
A string giving the palette name. |
... |
Additional arguments to pass to palette when it is a function but not a palette class function. |
palette |
A palette, |
warn_conflict |
A boolean which if |
The get_palette()
function returns a palette. The set_palette()
function is called for side effects and returns nothing.
# Get one of the known palettes
get_palette("hue")
# Set a new custom palette
cols <- c("palegreen", "deepskyblue", "magenta")
set_palette("aurora", palette = cols)
# Palette is now known
"aurora" %in% palette_names()
as_continuous_pal("aurora")
# Resetting palettes
reset_palettes()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.