get_colour_palette {saros} | R Documentation |
Provide A Colour Set for A Number of Requested Colours
Description
Possibly using colour_palette_nominal if available. If not sufficient, uses a set palette from RColorBrewer.
Usage
get_colour_palette(
data,
col_pos,
colour_palette_nominal = NULL,
colour_palette_ordinal = NULL,
colour_na = NULL,
categories_treated_as_na = NULL,
call = rlang::caller_env()
)
Arguments
data |
Survey data
A data frame (or a srvyr-object) with the columns specified in the chapter_overview 'dep_cat', etc columns. |
col_pos |
Character vector of column names for which colours will be found. |
colour_palette_nominal , colour_palette_ordinal |
User specified colour set
User-supplied default palette, excluding |
colour_na |
Colour for NA category
Colour as a single string for NA values. |
categories_treated_as_na |
NA categories
Categories that should be treated as NA. |
call |
Internal call
Both the absolute and relative folderpaths are required, as strings. |
Value
A colour set as character vector, where NA
has the colour_na
, and the rest are taken from colour_palette_nominal if available.
Examples
get_colour_palette(ex_survey, col_pos=c("b_1", "b_2"))
get_colour_palette(ex_survey, col_pos=c("b_1", "b_2"),
colour_palette_nominal = c("red", "blue", "orange"))