pal_preview: Print information and previews of the color palettes

View source: R/pal_preview.R

pal_previewR Documentation

Print information and previews of the color palettes

Description

pal_names() displays the list of the palette names currently included in pal. pal_table() generates a formatted tibble with information on the properties of all of the included palettes. pal_colors() displays the palette tibble for the selected palette. pal_preview() displays a simple preview of the selected colors in the graphics window, based on the show_col() function from the scales package.

Usage

pal_preview(
  palette = "default",
  ncol = NULL,
  colors = NULL,
  species = NULL,
  alpha = 1,
  labels = NULL,
  columns = NULL
)

pal_names()

pal_colors(palette = "default")

pal_table()

Arguments

palette

Character vector of length 1 defining the palette to select colors from; use pal_names() to see a list of available palettes, default palette is named "default"

ncol

Range of colors to select from palette; if only one number is provided, it will be the number of colors selected; can only use one selection technique

colors

Names of colors to select from palette, given as a character vector; can only use one selection technique

species

Names of species to select from palette (e.g., "IL6" or "Tocilizumab"), given as a character vector; can only use one selection technique

alpha

new alpha level in [0,1]. If alpha is NA, existing alpha values are preserved. Default is 1. Uses alpha() to set the alpha value

labels

What text to use for the color preview labels, options are color, hex, or species, default is color

columns

How many columns to use for the color preview, defaults to approximately square

Table Format

For pal_table():

Name

The palette name, used in the pal_*() functions

Key

Logical value, if the palette is one of the main, standard palettes

Named

Logical value, if the palette table contains a name column with species names

Type

Factor, what category of information should be depicted each palette

Length

Integer, number of colors in palette

Brightness

Factor, is palette the Standard version, Light, or Dark

Examples

pal_preview("antibodies", labels = "species", columns = 2)
pal_preview("receptors", species = c("IL6R", "IL6R-Ab"), labels = "hex")

christyray/crthemes documentation built on April 14, 2023, 11:18 p.m.