Create a PCA scatter plot from log-expression data with sample labels.
pcaPlot(
logcounts,
Sample,
Group,
title,
palette,
maxOverlaps,
sizeLabel,
center,
scale
)
A "ggplot" object displaying the PCA scatter plot of PC1 vs PC2.
Numeric matrix of log-CPM values (genes × samples), e.g., from edgeR::cpm.
Character vector of sample names corresponding to the columns of "logcounts".
Factor or character vector denoting group/condition for each sample.
Character. Title for the PCA plot.
Character. Name of a discrete color palette from the "paletteer" package.
Integer. Maximum number of overlapping labels allowed by "ggrepel".
Numeric. Font size for sample labels.
Logical. If TRUE, center variables before PCA.
Logical. If TRUE, scale variables to unit variance before PCA.
This function performs Principal Component Analysis (PCA) on a log-count matrix and visualizes the first two principal components using ggplot2 and ggrepel. Each point represents a sample, colored by group, with hover labels.
Transposes the "logcounts" matrix so samples are rows.
Runs PCA via "stats::prcomp()" with centering and scaling options.
Calculates percent variance explained by PC1 and PC2.
Builds a scatter plot with black‐bordered points and non‐overlapping labels.