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

View source: R/codegen.R

pal_functionsR Documentation

Output a character vector containing code for a ggplot2 scale

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

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

pal_functions("rainier")


wacolors documentation built on March 18, 2022, 6:08 p.m.