plotDots | R Documentation |
Create a dot plot of expression values for a grouping of cells, where the size and colour of each dot represents the proportion of detected expression values and the average expression, respectively, for each feature in each group of cells.
plotDots(
object,
features,
group = NULL,
block = NULL,
exprs_values = "logcounts",
detection_limit = 0,
zlim = NULL,
colour = color,
color = NULL,
max_detected = NULL,
other_fields = list(),
by_exprs_values = exprs_values,
swap_rownames = NULL,
center = FALSE,
scale = FALSE,
assay.type = exprs_values,
by.assay.type = by_exprs_values
)
object |
A SingleCellExperiment object. |
features |
A character (or factor) vector of row names, a logical vector, or integer vector of indices specifying rows of |
group |
String specifying the field of |
block |
String specifying the field of |
exprs_values |
Alias to |
detection_limit |
Numeric scalar providing the value above which observations are deemed to be expressed. |
zlim |
A numeric vector of length 2, specifying the upper and lower bounds for colour mapping of expression values.
Values outside this range are set to the most extreme colour.
If |
colour |
A vector of colours specifying the palette to use for increasing expression.
This defaults to viridis if |
color |
Alias to |
max_detected |
Numeric value specifying the cap on the proportion of detected expression values. |
other_fields |
Additional feature-based fields to include in the data.frame, see |
by_exprs_values |
Alias for |
swap_rownames |
Column name of |
center |
A logical scalar indicating whether each feature should have its mean expression (specifically, the mean of averages across all groups) centered at zero prior to plotting. |
scale |
A logical scalar specifying whether each row should have its average expression values scaled to unit variance prior to plotting. |
assay.type |
A string or integer scalar indicating which assay of |
by.assay.type |
A string or integer scalar specifying which assay to obtain expression values from, for entries of |
This implements a Seurat-style “dot plot” that creates a dot for each feature (row) in each group of cells (column).
The proportion of detected expression values and the average expression for each feature in each group of cells is visualized efficiently using the size and colour, respectively, of each dot.
If block
is specified, batch-corrected averages and proportions for each group are computed with correctGroupSummary
.
Some caution is required during interpretation due to the difficulty of simultaneously interpreting both size and colour. For example, if we coloured by z-score on a conventional blue-white-red colour axis, a gene that is downregulated in a group of cells would show up as a small blue dot. If the background colour was also white, this could be easily mistaken for a gene that is not downregulated at all. We suggest choosing a colour scale that remains distinguishable from the background colour at all points. Admittedly, that is easier said than done as many colour scales will approach a lighter colour at some stage, so some magnifying glasses may be required.
We can also cap the colour and size scales using zlim
and max_detected
, respectively.
This aims to preserve resolution for low-abundance genes by preventing domination of the scales by high-abundance features.
A ggplot object containing a dot plot.
Aaron Lun
plotExpression
and plotHeatmap
,
for alternatives to visualizing group-level expression values.
sce <- mockSCE()
sce <- logNormCounts(sce)
plotDots(sce, features=rownames(sce)[1:10], group="Cell_Cycle")
plotDots(sce, features=rownames(sce)[1:10], group="Cell_Cycle", center=TRUE)
plotDots(sce, features=rownames(sce)[1:10], group="Cell_Cycle", scale=TRUE)
plotDots(sce, features=rownames(sce)[1:10], group="Cell_Cycle", center=TRUE, scale=TRUE)
plotDots(sce, features=rownames(sce)[1:10], group="Treatment", block="Cell_Cycle")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.