pca_screeplot: PCA scree plot

View source: R/pca.R

pca_screeplotR Documentation

PCA scree plot

Description

Draws a scree plot with individual and cumulative explained variance.

Usage

pca_screeplot(
  pca.result,
  num.pcs = NULL,
  cex.leg = 0.8,
  leg.pos = "right",
  lab.text = c("individual percent", "cumulative percent"),
  fill.col = c("blue", "red"),
  ylab = "Percentage",
  xlab = "Principal components",
  ...
)

Arguments

pca.result

PCA result object.

num.pcs

Number of principal components to display.

cex.leg

Legend text size.

leg.pos

Legend position.

lab.text

Legend labels.

fill.col

Line colours.

ylab

Y-axis label.

xlab

X-axis label.

...

Additional graphical parameters.

Value

No return value, called for its side effect of plotting.

Examples

datamat <- matrix(
  rnorm(20),
  nrow = 4,
  dimnames = list(paste0("x", 1:4), paste0("s", 1:5))
)
metadata <- data.frame(class = factor(c("A", "A", "B", "B", "A")))
dataset <- list(data = datamat, metadata = metadata)
pca_res <- pca_analysis_dataset(dataset)
pca_screeplot(pca_res)


specmine documentation built on Aug. 5, 2026, 5:06 p.m.