plotExplanatoryPCs: Plot the explanatory PCs for each variable

View source: R/plotExplanatoryPCs.R

plotExplanatoryPCsR Documentation

Plot the explanatory PCs for each variable

Description

Plot the explanatory PCs for each variable

Usage

plotExplanatoryPCs(
  object,
  nvars_to_plot = 10,
  npcs_to_plot = 50,
  theme_size = 10,
  ...
)

Arguments

object

A SingleCellExperiment object containing expression values and experimental information. Alternatively, a matrix containing the output of getExplanatoryPCs.

nvars_to_plot

Integer scalar specifying the number of variables with the greatest explanatory power to plot. This can be set to Inf to show all variables.

npcs_to_plot

Integer scalar specifying the number of PCs to plot.

theme_size

numeric scalar providing base font size for ggplot theme.

...

Parameters to be passed to getExplanatoryPCs.

Details

A density plot is created for each variable, showing the R-squared for each successive PC (up to npcs_to_plot PCs). Only the nvars_to_plot variables with the largest maximum R-squared across PCs are shown.

If object is a SingleCellExperiment object, getExplanatoryPCs will be called to compute the variance in expression explained by each variable in each gene. Users may prefer to run getExplanatoryPCs manually and pass the resulting matrix as object, in which case the R-squared values are used directly.

Value

A ggplot object.

Examples

example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runPCA(example_sce)

plotExplanatoryPCs(example_sce)

Alanocallaghan/scater documentation built on July 18, 2024, 10:58 p.m.