World Health Organization-inspired palettes

who_palettes(palette = "main", reverse = FALSE, n = NULL,
  add_missings = FALSE, ...)

Arguments

palette

A character string. the colours of choice, current options are "main", "light" and "misc" for mixed colours as well as "purple", "turquoise", "blue", "magenta", "brown", "misc", "green", and "red".

reverse

Logical, defaults to FALSE. Should the palette be reversed.

n

Number of colours desired. If a specific value is given which corresponds to the length of a palette used in the 2019 WHO TB report, this palette is returned, else the number of entries in the palette with the most colour options (up to its full length) is returned. Defaults to NULL which returns the longest palette.

add_missings

Add a grey and white colour to the palette, defaults to FALSE.

...

Pass additional arguments to colorRampPalette.

See also

scale_colour_who scale_fill_who

Examples

# Set up the main palette but reversed. who_palettes(palette = "main", reverse = TRUE)
#> function (n) #> { #> x <- ramp(seq.int(0, 1, length.out = n)) #> if (ncol(x) == 4L) #> rgb(x[, 1L], x[, 2L], x[, 3L], x[, 4L], maxColorValue = 255) #> else rgb(x[, 1L], x[, 2L], x[, 3L], maxColorValue = 255) #> } #> <bytecode: 0x87c3cd8> #> <environment: 0x978c430>