R/utils_plotting.R
getClusterColours.Rd
Given a seurat object, get a named character vector of cluster colours, where
names are cluster names (coresponding to levels(seurat@ident)
), and
values are hex codes of the colours, either the default colours from Seurat,
or colours you specify. This is trivial to make this yourself,
so this is used as a utility function for retaining the colours of
clusters you want to highlight, and setting the colours of all other clusters
to grey, or another default, non-intrusive colour.
getClusterColours(seurat, clusters = NULL, original_colours = NULL, default_colour = "gray80")
seurat | Seurat object |
---|---|
clusters | Vector of one or more clusters to highlight, matching the levels at
|
original_colours | (Optional) Vector of colours to use. Either one colour
per cluster, in the order of |
default_colour | Colour to use for non-highlighted clusters Default: gray80 (light grey). |
Named character vector
# Trivial: get named character vector with default colours getClusterColours(pbmc)#> 0 1 2 3 #> "#F8766D" "#7CAE00" "#00BFC4" "#C77CFF"#> 0 1 2 3 #> "gray80" "gray80" "#00BFC4" "#C77CFF"# Highlight clusters 2 and 3, set all other cluster colours to white getClusterColours(pbmc, clusters = c(2, 3), default_colour = "white")#> 0 1 2 3 #> "white" "white" "#00BFC4" "#C77CFF"