save_colors: Save Custom Color Settings to a Seurat Object

View source: R/Colors.R

save_colorsR Documentation

Save Custom Color Settings to a Seurat Object

Description

This function stores custom color settings within a Seurat object, allowing these settings to be reused across various visualization functions within the Seurat environment.

Usage

save_colors(seu, col_list)

Arguments

seu

A Seurat object to which the color settings will be saved.

col_list

A list of color settings where names correspond to variable names and values are the colors to be associated with each variable.

Details

'save_colors' enhances workflow efficiency by centralizing color management within the Seurat object. This enables consistent and coherent visualizations across multiple plots, reducing the need for repeated color specifications and ensuring that plots are both aesthetically pleasing and informative.

Value

The modified Seurat object with updated color settings in the 'misc' slot.

Examples

library(SeuratExtend)

# Define custom colors for different clusters and genes
custom_colors <- list(
  "cluster" = "pro_blue",
  "CD14" = "D",
  "CD3D" = c("#EEEEEE", "black")
)
# Save these colors to the Seurat object
pbmc <- save_colors(pbmc, custom_colors)
# Use the colors in DimPlot2
DimPlot2(pbmc, features = c("cluster", "CD14", "CD3D"))


huayc09/SeuratExtend documentation built on July 15, 2024, 6:22 p.m.