pal_select: Select from the defined color palettes

View source: R/pal_select.R

pal_selectR Documentation

Select from the defined color palettes

Description

This selects hex codes from the palettes defined in the internal pal dataset. The list of available palettes can be previewed with pal_names(). Subsets of colors can be selected with the ncol, colors, or species arguments. Only one selection method can be used in the function call. If no selection method is provided, the function will return the full color palette with color names.

Usage

pal_select(
  palette = "default",
  ncol = NULL,
  colors = NULL,
  species = NULL,
  alpha = 1
)

Arguments

palette

Character vector of length 1 defining the palette to select colors from; use pal_names() to see a list of available palettes, default palette is named "default"

ncol

Range of colors to select from palette; if only one number is provided, it will be the number of colors selected; can only use one selection technique

colors

Names of colors to select from palette, given as a character vector; can only use one selection technique

species

Names of species to select from palette (e.g., "IL6" or "Tocilizumab"), given as a character vector; can only use one selection technique

alpha

new alpha level in [0,1]. If alpha is NA, existing alpha values are preserved. Default is 1. Uses alpha() to set the alpha value

Value

A named character vector with the hex codes of the selected colors. Color names are given for ncol and colors selections, and species names are given for species selection.

Examples

pal_select("receptors")
pal_select("receptors", ncol = 3)
pal_select("receptors", ncol = c(2,5))
pal_select("receptors", colors = c("lightred", "red", "orange"))
pal_select("receptors", species = c("IL8", "IL8R", "IL8R-Ab"))

christyray/crthemes documentation built on April 14, 2023, 11:18 p.m.