Skip to contents

Generate a PCA plot of combined groups with optional coloring and shaping. Axis labels always include variance explained for the selected PCs.

Usage

plot_pca_cluster(
  X,
  Y,
  MX,
  MY,
  color_var = NULL,
  shape_var = NULL,
  pcs = c(1, 2),
  title = NULL,
  x_label = NULL,
  y_label = NULL,
  point_size = 1
)

Arguments

X

Numeric matrix or data frame for the first group.

Y

Numeric matrix or data frame for the second group.

MX

Metadata for X.

MY

Metadata for Y.

color_var

Name of the metadata variable for color (optional).

shape_var

Name of the metadata variable for shape (optional).

pcs

Integer vector of length 2 indicating which PCs to plot (default c(1,2)).

title

Plot title.

x_label

X-axis label.

y_label

Y-axis label.

point_size

Size of the points.

Value

A ggplot object.