Description Usage Arguments Details Value See Also Examples
View source: R/get_col_palette.R
Get color palette in the form of colorRampPalette color interpolation functions. Use with get_col_gradient() or get_element_colors() from this package.
1 | get_col_palette(brew_pal = NA, custom = NA, rev = F)
|
brew_pal |
character string or NA. Exact name of RColorBrewer palette. e.g. "RdBu". |
custom |
Na or character vector with colors specifying palette order. e.g. c("red", "white", "blue"). Any hex codes or R colors (see colors()) can be used. |
rev |
logical; should the brew_pal color palette order be reversed? |
Only one of the parameters (brew_pal or custom) must be specified (not NA), otherwise function will use custom only.
A colorRampPalette color interpolation functions.
colorRampPalette function from grDevices. See ?colorRampPalette.
1 2 3 4 5 6 7 8 9 10 11 | # Make a color palette of red to blue (RColorBrewer)
# The two lines of code below are equivalent
get_col_palette(brew_pal = "RdBu")
colorRampPalette(RColorBrewer::brewer.pal(9, "RdBu"))
#' # Reverse the palette (i.e. blue to red)
get_col_palette(brew_pal = "RdBu", rev = T)
# Make a custom color palette of forestgreen to darkorchid4 (RColorBrewer)
# The two lines of code below are equivalent
get_col_palette(custom = c("forestgreen", "darkorchid4"))
colorRampPalette(c("forestgreen", "darkorchid4"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.