Skip to contents

Plots the percent variance explained by each principal component as a lines+markers trace, with an optional cumulative variance overlay.

Usage

interactive_screeplot(
  fraction_explained,
  n_components = NULL,
  cumulative = FALSE,
  palette_name = COLORBLIND_PALETTE_NAME,
  title = "Scree plot",
  component_labels = NULL
)

Arguments

fraction_explained

Numeric vector of percent variance explained by each principal component, in order (e.g. from calculatePCAFractionExplained, or the percentVar element returned by compile_pca_data).

n_components

Number of leading components to plot. Defaults to all of fraction_explained.

cumulative

Boolean: add a cumulative variance explained trace?

palette_name

Valid R color palette name

title

Plot title

component_labels

Optional character vector of length n_components to use as the x-axis categories instead of the plain "PC1", "PC2", ... labels. Used by interactive_pca_variance_heatmap to match this plot's x-categories to the percent-suffixed column labels of the heatmap it's stacked with.

Value

output Plotly plot object

Examples

interactive_screeplot(c(45, 25, 15, 10, 5))