get_col_palette: Get color palette in the form of colorRampPalette functions.

Description Usage Arguments Details Value See Also Examples

View source: R/get_col_palette.R

Description

Get color palette in the form of colorRampPalette color interpolation functions. Use with get_col_gradient() or get_element_colors() from this package.

Usage

1
get_col_palette(brew_pal = NA, custom = NA, rev = F)

Arguments

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?

Details

Only one of the parameters (brew_pal or custom) must be specified (not NA), otherwise function will use custom only.

Value

A colorRampPalette color interpolation functions.

See Also

colorRampPalette function from grDevices. See ?colorRampPalette.

Examples

 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"))

kazeera/kazcolors documentation built on Aug. 19, 2021, 11:04 a.m.