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 thepercentVarelement returned bycompile_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_componentsto use as the x-axis categories instead of the plain"PC1","PC2", ... labels. Used byinteractive_pca_variance_heatmapto match this plot's x-categories to the percent-suffixed column labels of the heatmap it's stacked with.
Examples
interactive_screeplot(c(45, 25, 15, 10, 5))
