palette_scp: Color palettes collected in SCP.

View source: R/SCP-plot.R

palette_scpR Documentation

Color palettes collected in SCP.

Description

Color palettes collected in SCP.

Usage

palette_scp(
  x,
  n = 100,
  palette = "Paired",
  palcolor = NULL,
  type = "auto",
  matched = FALSE,
  reverse = FALSE,
  NA_keep = FALSE,
  NA_color = "grey80"
)

Arguments

x

A vector of character/factor or numeric values. If missing, numeric values 1:n will be used as x.

n

The number of colors to return for numeric values.

palette

Palette name. All available palette names can be queried with show_palettes().

palcolor

Custom colors used to create a color palette.

type

Type of x. Can be one of "auto", "discrete" or "continuous". The default is "auto", which automatically detects if x is a numeric value.

matched

If TRUE, will return a color vector of the same length as x.

reverse

Whether to invert the colors.

NA_keep

Whether to keep the color assignment to NA in x.

NA_color

Color assigned to NA if NA_keep is TRUE.

See Also

show_palettes palette_list

Examples

x <- c(1:3, NA, 3:5)
(pal1 <- palette_scp(x, palette = "Spectral"))
(pal2 <- palette_scp(x, palcolor = c("red", "white", "blue")))
(pal3 <- palette_scp(x, palette = "Spectral", n = 10))
(pal4 <- palette_scp(x, palette = "Spectral", n = 10, reverse = TRUE))
(pal5 <- palette_scp(x, palette = "Spectral", matched = TRUE))
(pal6 <- palette_scp(x, palette = "Spectral", matched = TRUE, NA_keep = TRUE))
(pal7 <- palette_scp(x, palette = "Paired", type = "discrete"))
show_palettes(list(pal1, pal2, pal3, pal4, pal5, pal6, pal7))

all_palettes <- show_palettes(return_palettes = TRUE)
names(all_palettes)


zh542370159/SCP documentation built on Nov. 22, 2023, 2:34 a.m.