plotProjections | R Documentation |
This function make use of plotProjection()
to show cells on two
pre-calculated low-dimensional projection (such as UMAP and t-SNE) in
a compound figure.
plotProjections(
sce,
feature,
dimnames = c("TSNE", "UMAP"),
feat_desc = NULL,
feat_color = NULL,
color_breaks = waiver(),
color_limits = NULL,
exprs_by = "logcounts",
text_by = NULL,
point_size = 1,
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,
titles = NULL,
show_title = TRUE,
show_subtitle = TRUE,
other_fields = list(),
add_void = FALSE,
rel_widths = c(15, 1),
rel_heights = c(15, 1),
...
)
sce |
A |
feature |
A string indicating the column name in |
dimnames |
A character or integer vector of length 2 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 1. |
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 |
titles |
A character vector of length 2 indicating the 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 |
add_void |
Logical scalar indicating whether to add a completely empty
theme using |
rel_widths |
A numeric vector of relative columns widths. For example,
in a two-column grid, |
rel_heights |
A numerical vector of relative rows heights. Works just
as |
... |
Other arguments passed on to |
The function uses plotProjection()
to create 2 base plots, then get_Legend()
to produce a shared legend and plot_grid()
from cowplot to create a compound
figure with legend placed at the desired position as specified by legend_pos
.
A ggplot2 plot with an object of class c("gg", "ggplot")
I-Hsuan Lin
plotProjection()
, scater::plotReducedDim()
# Load demo dataset
data(sce)
# Plot TSNE and UMAP side-by-side
plotProjections(sce, "label",
dimname = c("TSNE", "UMAP"), text_by = "label",
feat_desc = "Cluster"
)
# Show DKD62 expression
plotProjections(sce, "DKD62",
dimname = c("TSNE", "UMAP"), text_by = "label",
feat_desc = "DKD62 Expression", guides_barwidth = 15
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.