plotProjection | R Documentation |
This function uses plotReducedDim()
from the scater package to
show cells on a pre-calculated low-dimensional projection (such as UMAP or
t-SNE) and colour by a choosen cell-specific feature. It uses add_label()
to label cells when text_by
is used.
plotProjection(
sce,
feature,
dimname = "TSNE",
feat_desc = NULL,
feat_color = NULL,
color_breaks = waiver(),
color_limits = NULL,
exprs_by = "logcounts",
text_by = NULL,
point_size = 2,
point_alpha = 0.5,
theme_size = 18,
show_na = FALSE,
na.value = "grey50",
legend_pos = "right",
legend_just = "center",
guides_ncol = NULL,
guides_nrow = NULL,
guides_barwidth = NULL,
guides_barheight = NULL,
guides_size = point_size * 2,
title = NULL,
show_title = TRUE,
show_subtitle = TRUE,
other_fields = list(),
...
)
sce |
A |
feature |
A string indicating the column name in |
dimname |
A string or integer scalar indicating the reduced dimension
result in |
feat_desc |
A string that describes the coloured feature. Default is
|
feat_color |
A character vector of colour codes indicating the colours
of the features, or a palette function that creates a vector of colours
along a colour map. Default is |
color_breaks |
For colouring continuous data, one of:
|
color_limits |
For colouring continuous data, one of:
|
exprs_by |
A string or integer scalar specifying which assay from
|
text_by |
A string indicating the column metadata field with which
to add text labels on the plot. Default is |
point_size |
A numeric scalar indicating the size of the points. Default is 2. |
point_alpha |
A numeric scalar (between 0 and 1) indicating the transparency. Default is 0.5. |
theme_size |
A numeric scalar indicating the base font size. Default is 18. |
show_na |
Logical scalar indicating whether to show |
na.value |
Colour to use for missing values. Default is |
legend_pos |
The position of legends ("none", "left", "right", "bottom","top". Use "none" to disable plot legend. Default is "right". |
legend_just |
The anchor point for positioning legend inside plot ("center" or two-element numeric vector) or the justification according to the plot area when positioned outside the plot. Default is "center". |
guides_ncol , guides_nrow |
An integer scalar indicating the desired number of column and row of discrete legends. Default is NULL. |
guides_barwidth , guides_barheight |
A numeric or a |
guides_size |
An integer scalar indicating the desired size of the
points in a discrete legend. Default is |
title |
Plot title. Default is |
show_title |
Logical scalar indicating whether to show plot title.
Default is |
show_subtitle |
Logical scalar indicating whether to show plot
subtitle, Default is |
other_fields |
Additional cell-based fields to include in the
DataFrame. Default is |
... |
Other arguments passed on to |
The function uses plotReducedDim()
from the scater package to
create a base plot and adds aesthetic, such as point colours, legend
controls, title and subtitles, to the final figure.
A ggplot
object
I-Hsuan Lin
scater::plotReducedDim()
# Load demo dataset
data(sce)
# Colour and label cells by cluster
plotProjection(sce, "label",
dimname = "TSNE", text_by = "label",
feat_desc = "Cluster"
)
# Colour cells by DKD62 expression and label by cluster
plotProjection(sce, "DKD62",
dimname = "UMAP", text_by = "label",
feat_desc = "DKD62 Expression", guides_barheight = 15
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.