getDiscretePaletteObj: Generate a Discrete Color Palette for Seurat Clusters

View source: R/Seurat.Utils.Visualization.R

getDiscretePaletteObjR Documentation

Generate a Discrete Color Palette for Seurat Clusters

Description

Generates a discrete color palette for visualizing clusters in a Seurat object, using a specified identity column to determine the number of unique clusters.

Usage

getDiscretePaletteObj(
  ident.used,
  obj,
  palette.used = c("alphabet", "alphabet2", "glasbey", "polychrome", "stepped")[2],
  show.colors = FALSE,
  seed = 1989
)

Arguments

ident.used

Identity column in the Seurat object to base the color palette on.

obj

Seurat object containing clustering information.

palette.used

The palette name to use for color generation. Options include "alphabet", "alphabet2", "glasbey", "polychrome", and "stepped". Default: "alphabet2".

show.colors

If TRUE, displays the generated colors. Default: FALSE.

seed

Seed for random color generation, ensuring reproducibility. Default: 1989.

Value

A character vector of color values corresponding to the number of clusters.

Examples

## Not run: 
if (interactive()) {
  ident.used <- "resolution_1"
  obj <- YourSeuratObject
  colors <- getDiscretePaletteObj(ident.used = ident.used, obj = obj)
  print(colors)
}

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.