Skip to contents

Produces a bar chart showing the percentage of variance explained by each principal component, using the output of run_pca().

Usage

plot_variance_explained(pca_result, n_pcs = 8)

Arguments

pca_result

Output from run_pca().

n_pcs

Maximum number of PCs to display. Default: 8.

Value

A ggplot object.

Author

Jared Andrews

Examples

data(airway, package = "airway")
result <- run_pca(airway, n_top = 50)
plot_variance_explained(result)