PlotPCA.RdVisualize principal component analysis (PCA) results stored within a
GenEDA object. This function extracts PCA data via ExtractPCA
and provides a flexible ggplot2-based visualization interface.
PlotPCA(
object,
x = 1,
y = 2,
color_by,
colors = NULL,
split_by = NULL,
shape_by = NULL,
return_data = FALSE
)A GenEDA object containing PCA results in the DimReduction slot.
Numeric or character. The principal component to plot on the x-axis (e.g., 1 or "PC1").
Numeric or character. The principal component to plot on the y-axis (e.g., 2 or "PC2").
Character. Column name in the metadata used to color points.
Vector. Custom colors to use for plotting
Character (optional). Column name in metadata used for faceting (creates separate panels).
Character (optional). Column name in metadata used to control point shape.
Logical (default = FALSE), whether or not to return pca dataframe for more custom plotting.
A ggplot object displaying the PCA scatter plot, or a list of pca_df and plot if return_data = TRUE
if (FALSE) { # \dontrun{
p <- PlotPCA(obj, x = 1, y = 2, color_by = "condition",
colors = c("untreated" = "red", "treated" = "blue"),
split_by = "library")
p
} # }