embeddingPlot generic Plot embedding with provided labels / colors using ggplot2
Plot embedding with provided labels / colors using ggplot2
Plot embedding from Seurat object
embeddingPlot(object, ...)# S4 method for ANY
embeddingPlot(
object,
groups = NULL,
colors = NULL,
subgroups = NULL,
plot.na = is.null(subgroups),
min.cluster.size = 0,
mark.groups = TRUE,
show.legend = FALSE,
alpha = 0.4,
size = 0.8,
title = NULL,
plot.theme = NULL,
palette = NULL,
color.range = "symmetric",
font.size = c(3, 7),
show.ticks = FALSE,
show.labels = FALSE,
legend.position = NULL,
legend.title = NULL,
gradient.range.quantile = 1,
raster = FALSE,
raster.dpi = 300,
shuffle.colors = FALSE,
keep.limits = !is.null(subgroups),
...
)
# S4 method for Seurat
embeddingPlot(object, reduction = NULL, groups = NULL, colors = NULL, ...)
ggplot2 object
ggplot2 object
Seurat object
Arguments passed on to ggrepel::geom_label_repel
dataA data frame. If specified, overrides the default data frame defined at the top level of the plot.
statThe statistical transformation to use on the data for this layer, as a string.
positionPosition adjustment, either as a string, or the result of a call to a position adjustment function.
parseIf TRUE, the labels will be parsed into expressions and displayed as described in ?plotmath
box.paddingAmount of padding around bounding box, as unit or number.
Defaults to 0.25. (Default unit is lines, but other units can be specified
by passing unit(x, "units")).
label.paddingAmount of padding around label, as unit or number.
Defaults to 0.25. (Default unit is lines, but other units can be specified
by passing unit(x, "units")).
point.paddingAmount of padding around labeled point, as unit or
number. Defaults to 0. (Default unit is lines, but other units can be
specified by passing unit(x, "units")).
label.rRadius of rounded corners, as unit or number. Defaults
to 0.15. (Default unit is lines, but other units can be specified by
passing unit(x, "units")).
label.sizeSize of label border, in mm.
min.segment.lengthSkip drawing segments shorter than this, as unit or
number. Defaults to 0.5. (Default unit is lines, but other units can be
specified by passing unit(x, "units")).
arrowspecification for arrow heads, as created by arrow
forceForce of repulsion between overlapping text labels. Defaults to 1.
force_pullForce of attraction between a text label and its corresponding data point. Defaults to 1.
max.timeMaximum number of seconds to try to resolve overlaps. Defaults to 0.5.
max.iterMaximum number of iterations to try to resolve overlaps. Defaults to 10000.
max.overlapsExclude text labels when they overlap too many other things. For each text label, we count how many other text labels or other data points it overlaps, and exclude the text label if it has too many overlaps. Defaults to 10.
nudge_x,nudge_yHorizontal and vertical adjustments to nudge the
starting position of each text label. The units for nudge_x and
nudge_y are the same as for the data units on the x-axis and y-axis.
xlim,ylimLimits for the x and y axes. Text labels will be constrained to these limits. By default, text labels are constrained to the entire plot area.
na.rmIf FALSE (the default), removes missing values with
a warning. If TRUE silently removes missing values.
direction"both", "x", or "y" -- direction in which to adjust position of labels
seedRandom seed passed to set.seed. Defaults to
NA, which means that set.seed will not be called.
verboseIf TRUE, some diagnostics of the repel algorithm are printed
inherit.aesIf FALSE, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. borders.
vector of cluster labels, names contain cell names (default=NULL)
vector of numbers, which must be shown with point colors, names contain cell names (default=NULL). This argument is ignored if groups are provided.
subset of 'groups', selecting the cells for plot (default=NULL). Ignored if 'groups' is NULL
boolean/numeric Whether to plot points, for which groups / colors are missed (default=is.null(subgroups), i.e. FALSE). If plot.na passed a numeric value below 0, the NA symbols are plotted below the cells. Otherwise if values >=0, they’re plotted above the cells. Note that this argument is FALSE if 'subgroups' is NULL
labels for all groups with number of cells fewer than this parameter are considered as missed (default=0). This argument is ignored if groups aren't provided
plot cluster labels above points (default=TRUE)
show legend (default=FALSE)
opacity level [0, 1] (default=0.4)
point size (default=0.8)
plot title (default=NULL)
theme for the plot (default=NULL)
vector or list or function (default=NULL). Accepts number of colors and return list of colors (i.e. see 'colorRampPalette') (default=NULL)
controls range, in which colors are estimated (default="symmetric"). Pass "all" to estimate range based on all values of "colors", pass "data" to estimate it only based on colors, presented in the embedding. Alternatively you can pass vector of length 2 with (min, max) values.
font size for cluster labels (default=c(3, 7)). It can either be single number for constant font size or pair (min, max) for font size depending on cluster size
show ticks and tick labels (default=FALSE)
show labels (default=FALSE)
vector with (x, y) positions of the legend (default=NULL)
legend title (default=NULL)
Winsorization quantile for the numeric colors and gene gradient (default=1)
boolean whether layer with the points be rasterized (default=FALSE). Setting of this argument to TRUE is useful when you need to export a plot with large number of points
dpi of the rasterized plot. (default=300). Ignored if raster == FALSE.
shuffle colors (default=FALSE)
Keep axis limits from original plot (default=!is.null(subgroups)). Useful when plotting subgroups, only meaningful it plot.na=FALSE
Reduction to use for embedding (default=NULL)
library(sccore)
embeddingPlot(umapEmbedding, show.ticks=TRUE, show.labels=TRUE, title="UMAP embedding")
if (FALSE) {
# so = example Seurat object
embeddingPlot(so, groups="seurat_clusters", reduction="umap")
}
Run the code above in your browser using DataLab