On this page

Return the colors of the ALSCL plots for figures of your own.

Usage

acl_palette(n = NULL, palette = NULL, role = NULL)

Arguments

ArgumentDefaultDescription
nNULL

Integer or NULL. Number of colors. NULL returns the native colors of the palette; more colors than the palette holds are interpolated between its colors.

paletteNULL

Character or NULL. "default", "npg", "aaas", "nejm", "lancet" or "jama"; NULL uses the palette set with acl_theme_set(). Letter case does not matter.

roleNULL

Character vector or NULL. Names of color roles, "stock", "F", "recruitment", "catch" (the quantity families), "primary" (lines and points), "accent" (observations), "smooth" (smoothers) and "reference" (reference lines). With palette = NULL the colors are those of the current settings; a quantity without its own color uses the primary color. With a palette name they are the defaults of that palette. n is ignored. Letter case does not matter.

Value

A character vector of colors, named by role when role is given.

Details

Without arguments the function returns the native colors of the active palette, eight for the default palette "default", whose first two colors are dark blue #002b5f and orange #eb5c24. n gives that many colors, interpolated when the palette holds fewer. role returns the colors that the plots use. Under the default style "stock" is #047c6c, "F" #ed5f26, "recruitment" #28b3e8 and "catch" #002b5f; under "classic" these four take the primary color of the palette.

Examples

Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.

Example setup
library(ALSCL)
# Use objects defined above
acl_palette()
acl_palette(3)
acl_palette(12, palette = "npg")
acl_palette(role = c("stock", "F", "recruitment", "catch", "primary", "accent"))
Example figure
Example figure: for (p in c("default", "npg", "aaas", "nejm", "lancet", "jama")) scales::show_col(acl_palette(palette = p))

See also

Search documentation