Function to ensure colors match across plots
make_pal.Rd
Function to ensure colors match across plots
Usage
make_pal(
levels,
palette,
refvals = NULL,
refcols = NULL,
includeRef = FALSE,
returnUnref = FALSE,
direction = 1
)
Arguments
- levels
character vector of levels to use (should be all possible for the variable)
- palette
character vector of palette name from
paletteer
- refvals
character vector of levels we want to set manually (typically as references)
- refcols
character vector (names or hex) of colors to set manually in order matching
refvals
- includeRef
logical, defailt FALSE. Should the colors be chosen including (TRUE) or not including (FALSE, the default) the levels in
refvals
. TypicallyTRUE
if we sometimes want to accentuate a level, and sometimes not.- returnUnref
logical, default FALSE. Should we return the base palette with the refvals matched to
palette
in addition to the version where they matchrefcols
(TRUE). Only works ifincludeRef = TRUE
. IfTRUE
, returns a list with the base palette and the palette matchingrefcols
- direction
1 (default) or -1 (reverse the palette), as in
paletteer::paletteer_c()
andpaletteer::paletteer_d()