pal_vector: Output a character vector containing code for a palette

View source: R/codegen.R

pal_vectorR Documentation

Output a character vector containing code for a palette

Description

Call this function to get the code for a character vector containing a palette. If using RStudio, the code will be loaded at the console prompt; otherwise, it will be printed at the terminal.

Usage

pal_vector(
  palette,
  n,
  which = NULL,
  type = c("discrete", "continuous"),
  reverse = FALSE
)

Arguments

palette

The name of the palette (partial matching supported), or an actual palette from [wacolors].

n

The number of colors in the palette. If this exceeds the actual number and type is not provided, it will be set to continuous.

which

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

type

Either continuous or discrete. Use continuous if you want to automatically interpolate between colors.

reverse

TRUE if palette should be reversed.

Value

The generated code, invisibly, as a character vector.

Examples

pal_vector("rainier", 4)


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