plotReducedDim {scater} | R Documentation |
Plot cell-level reduced dimension results stored in a SingleCellExperiment object.
plotReducedDim(object, use_dimred, ncomponents = 2, percentVar = NULL, colour_by = NULL, shape_by = NULL, size_by = NULL, by_exprs_values = "logcounts", by_show_single = FALSE, ..., add_ticks = NULL)
object |
A SingleCellExperiment object. |
use_dimred |
A string or integer scalar indicating the reduced dimension result in |
ncomponents |
A numeric scalar indicating the number of dimensions to plot, starting from the first dimension. Alternatively, a numeric vector specifying the dimensions to be plotted. |
percentVar |
A numeric vector giving the proportion of variance in expression explained by each reduced dimension.
Only expected to be used in PCA settings, e.g., in the |
colour_by |
Specification of a column metadata field or a feature to colour by, see |
shape_by |
Specification of a column metadata field or a feature to shape by, see |
size_by |
Specification of a column metadata field or a feature to size by, see |
by_exprs_values |
A string or integer scalar specifying which assay to obtain expression values from,
for use in point aesthetics - see |
by_show_single |
Logical scalar specifying whether single-level factors should be used for point aesthetics, see |
... |
Additional arguments for visualization, see |
add_ticks |
Deprecated; logical scalar indicating whether ticks should be drawn on the axes corresponding to the location of each point. |
If ncomponents
is a scalar and equal to 2, a scatterplot of the first two dimensions is produced.
If ncomponents
is greater than 2, a pairs plots for the top dimensions is produced.
Alternatively, if ncomponents
is a vector of length 2, a scatterplot of the two specified dimensions is produced.
If it is of length greater than 2, a pairs plot is produced containing all pairwise plots between the specified dimensions.
A ggplot object
Davis McCarthy, with modifications by Aaron Lun
data("sc_example_counts") data("sc_example_cell_info") example_sce <- SingleCellExperiment( assays = list(counts = sc_example_counts), colData = sc_example_cell_info ) example_sce <- normalize(example_sce) example_sce <- runPCA(example_sce, ncomponents=5) plotReducedDim(example_sce, "PCA") plotReducedDim(example_sce, "PCA", colour_by="Cell_Cycle") plotReducedDim(example_sce, "PCA", colour_by="Gene_0001") plotReducedDim(example_sce, "PCA", ncomponents=5) plotReducedDim(example_sce, "PCA", ncomponents=5, colour_by="Cell_Cycle", shape_by="Treatment")