pal_vector: Output a character vector containing code for a palette

Description Usage Arguments Value Examples

View source: R/codegen.R

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

1
2
3
4
5
6
7
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

1
pal_vector("rainier", 4)

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