Helper function to return a number of discrete color palettes.

DiscretePalette_scCustomize(
  num_colors,
  palette = NULL,
  shuffle_pal = FALSE,
  seed = 123
)

Arguments

num_colors

Number of colors to be generated.

palette

Options are "alphabet", "alphabet2", "glasbey", "polychrome", "stepped", "ditto_seq", "varibow".

shuffle_pal

randomly shuffle the outputted palette. Most useful for varibow palette as that is normally an ordered palette.

seed

random seed for the palette shuffle. Default = 123.

Value

A vector of colors

References

This function uses the paletteer package https://github.com/EmilHvitfeldt/paletteer to provide simplified access to color palettes from many different R package sources while minimizing scCustomize current and future dependencies.

The following packages & palettes are called by this function (see individual packages for palette references/citations):

  1. pals (via paletteer) https://CRAN.R-project.org/package=pals

    • alphabet, alphabet2, glasbey, polychrome, and stepped.

  2. dittoSeq https://bioconductor.org/packages/release/bioc/html/dittoSeq.html

    • dittoColors.

  3. colorway https://github.com/hypercompetent/colorway

    • varibow

Function name and implementation modified from Seurat (License: GPL-3). https://github.com/satijalab/seurat

Examples

pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "varibow")
PalettePlot(pal= pal)