pal_functions: Output a character vector containing code for a 'ggplot2'...

Description Usage Arguments Value Examples

View source: R/codegen.R

Description

Call this function to get the code for the scale_* functions for a palette. If using RStudio, the code will be loaded at the console prompt; otherwise, it will be printed at the terminal. Assumes that ggplot2 has been loaded into the namespace, or will be by the time the scales are used.

Usage

1
2
3
4
5
6
pal_functions(
  palette,
  which = NULL,
  type = c("discrete", "continuous"),
  reverse = FALSE
)

Arguments

palette

a [wacolors] palette or palette name.

which

if not NULL, the indices or names of a subset of colors to use.

type

Either continuous, discrete, or binned. Use continuous if you want to automatically interpolate between colors. Custom scale midpoints are not supported (see scale_fill_wa_c()).

reverse

TRUE if the colors should be reversed.

Value

The generated code, invisibly, as a character vector.

Examples

1
pal_functions("rainier")

wacolors documentation built on May 17, 2021, 9:08 a.m.