| pca_kmeans_plot2D | R Documentation |
Plots PCA scores in 2D coloured by k-means cluster assignment.
pca_kmeans_plot2D(
dataset,
pca.result,
num.clusters = 3,
pcas = c(1, 2),
kmeans.result = NULL,
labels = FALSE,
bw = FALSE,
ellipses = FALSE,
leg.pos = "right",
xlim = NULL,
ylim = NULL
)
dataset |
Dataset used in the PCA. |
pca.result |
PCA result object. |
num.clusters |
Number of clusters. |
pcas |
Principal components to plot. |
kmeans.result |
Optional precomputed k-means result. |
labels |
Logical indicating whether sample labels should be shown. |
bw |
Logical indicating whether a black-and-white style should be used. |
ellipses |
Logical indicating whether cluster ellipses should be drawn. |
leg.pos |
Legend position. |
xlim |
Optional x-axis limits. |
ylim |
Optional y-axis limits. |
A ggplot object.
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_kmeans_plot2D(dataset, pca_res, num.clusters = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.