showPalettes: Display Color Palettes

View source: R/showPalettes.R

showPalettesR Documentation

Display Color Palettes

Description

For each specified palette class, display each palette in the class as a strip of colors in a single multi-panel PDF file.

Usage

showPalettes(palette=c("sequential", "hues", "viridis", "wesanderson"),
             n=12, border="transparent", file=NULL)

Arguments

palette

Name of the palette class to display, one of "sequential", "hues", "viridis", or "wesanderson". Default is "sequential".

n

Number of colors per palette. Default is 12 colors.

border

Color of the border between color strips, or "off" for no border. Default is "transparent".

file

Name of the PDF file to write. Default is the palette class name with a .pdf extension.

Details

Four palette classes are available:

  • "sequential": HCL sequential palettes for each of 12 hues across the HCL color wheel in 30-degree intervals, plus grayscale.

  • "hues": 16 qualitative palettes based on the HCL hue wheel, shown for all combinations of chroma and luminance from c \in \{20, 40, 60, 80\} and l \in \{20, 40, 60, 80\}, each labeled with its c and l values.

  • "viridis": The viridis, cividis, plasma, and spectral palettes.

  • "wesanderson": Palettes from the wesanderson package (which must be installed separately).

Author(s)

David W. Gerbing (Portland State University; gerbing@pdx.edu)

Examples

# default: sequential HCL palettes
#showPalettes()

# hues palettes across c x l grid
#showPalettes("hues")

# viridis palettes, simulate continuity with many small color blocks
#showPalettes("viridis", n=500, border="off")

lessR documentation built on June 21, 2026, 5:06 p.m.