ElbowPlot: Quickly Pick Relevant Dimensions

View source: R/visualization.R

ElbowPlotR Documentation

Quickly Pick Relevant Dimensions

Description

Plots per-component standard deviations (or approximate singular values if running PCAFast), percent variance explained per principal component, or cumulative percent variance explained, to help pick an elbow in the graph. This elbow often corresponds well with significant dimensions and is much faster to run than Jackstraw.

Usage

ElbowPlot(
  object,
  ndims = 20,
  reduction = "pca",
  plot_type = c("stdev", "variance", "cumulative_variance")
)

Arguments

object

Seurat object

ndims

Number of dimensions to plot (positive integer; capped by stored components)

reduction

Reduction technique to plot (default is 'pca')

plot_type

One of "stdev" (default), "variance" (per-PC % variance), or "cumulative_variance" (running sum of those percentages; equals 100% at the last stored PC when ndims spans all of them)

Value

A ggplot object

Examples

data("pbmc_small")
ElbowPlot(object = pbmc_small)
ElbowPlot(object = pbmc_small, plot_type = "variance")
ElbowPlot(object = pbmc_small, plot_type = "cumulative_variance")


Seurat documentation built on June 26, 2026, 5:08 p.m.