save_colors | R Documentation |
This function stores custom color settings within a Seurat object, allowing these settings to be reused across various visualization functions within the Seurat environment.
save_colors(seu, col_list)
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. |
'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.
The modified Seurat object with updated color settings in the 'misc' slot.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.