View source: R/exploratory_analysis.R
plot_PCA | R Documentation |
Plot Principal Component Analysis (PCA) of samples
plot_PCA(
exp,
metadata,
metadata_cols = NULL,
log_trans = FALSE,
PCs = c(1, 2),
size = 2
)
exp |
A gene expression data frame with genes in row names and samples in column names or a 'SummarizedExperiment' object. |
metadata |
A data frame of sample metadata containing sample names in row names and sample annotation in subsequent columns. Ignored if 'exp' is a 'SummarizedExperiment' object, since colData will be automatically extracted. |
metadata_cols |
A vector (either numeric or character) indicating which columns should be extracted from column metadata if exp is a 'SummarizedExperiment' object. The vector can contain column indices (numeric) or column names (character). By default, all columns are used. |
log_trans |
Logical indicating whether the gene expression matrix
should be log transformed using |
PCs |
Numeric vector of length 2 indicating the principal components
to be plotted on the x-axis and y-axis, respectively.
Default: |
size |
Numeric indicating the point size. Default is 2. |
A ggplot object with the PCA plot.
Fabricio Almeida-Silva
ggplot
data(zma.se)
plot_PCA(zma.se, log_trans = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.