Skip to contents

Dimension estimate diagnostic plot

Usage

DimsEstimatePlot(
  srt,
  max_pcs = 50,
  variance_thresholds = c(0.6, 0.7, 0.8, 0.9),
  reduction = NULL,
  palcolor = c("#D70440", "#0AA344", "#1772B4"),
  aspect.ratio = NULL,
  title = NULL,
  subtitle = NULL,
  xlab = "Principal component",
  theme_use = "theme_scop",
  theme_args = list(),
  seed = 11,
  verbose = TRUE
)

Arguments

srt

A Seurat object with a PCA-like reduction computed.

max_pcs

Maximum number of PCs to visualize.

variance_thresholds

Numeric vector of variance thresholds to mark.

reduction

Reduction name to inspect. Default is NULL, which automatically selects a PCA-like reduction via DefaultReduction() with pattern = "pca".

palcolor

Colors for the selected-PC line, curves, and bars, respectively.

aspect.ratio

Aspect ratio of the plot.

title

Plot title. When NULL (default), reports the selected number of PCs.

subtitle

Plot subtitle. Default is NULL.

xlab

X-axis label.

theme_use

Theme function used to style the plot.

theme_args

Other arguments passed to the theme_use.

seed

Random seed.

verbose

Whether to print the message. Default is TRUE.

Value

A ggplot object showing per-PC explained variance (bars, left axis) and cumulative explained variance (line, right axis).

See also

Examples

data(pancreas_sub)
pancreas_sub <- RunStandardWorkflow(pancreas_sub)
#>  [2026-08-30 04:21:30] Start standard processing workflow...
#>  [2026-08-30 04:21:30] Checking a list of <Seurat>...
#> ! [2026-08-30 04:21:30] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#>  [2026-08-30 04:21:30] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-08-30 04:21:30] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 04:21:30] Use the separate HVF from `srt_list`
#>  [2026-08-30 04:21:30] Number of available HVF: 2000
#>  [2026-08-30 04:21:30] Finished check
#>  [2026-08-30 04:21:30] Perform `ScaleData()`
#>  [2026-08-30 04:21:30] Perform pca linear dimension reduction
#>  [2026-08-30 04:21:30] Use stored estimated dimensions 1:23 for Standardpca
#>  [2026-08-30 04:21:31] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 04:21:31] Reorder clusters...
#>  [2026-08-30 04:21:31] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 04:21:31] Perform umap nonlinear dimension reduction
#>  [2026-08-30 04:21:37] Standard processing workflow completed
DimsEstimatePlot(pancreas_sub)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's linetype values.