Description Usage Arguments Value Author(s) Examples
View source: R/utils_plotting.R
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.
1 2 | 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
Selin Jessa
1 2 3 4 5 6 7 8 | # Trivial: get named character vector with default colours
getClusterColours(pbmc)
# Highlight clusters 2 and 3
getClusterColours(pbmc, clusters = c(2, 3))
# Highlight clusters 2 and 3, set all other cluster colours to white
getClusterColours(pbmc, clusters = c(2, 3), default_colour = "white")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.