ordinationPlot {MatrixQCvis} | R Documentation |
The function 'ordinationPlot' creates a dimension reduction plot. The function takes as input the 'tbl' object obtained from the 'ordination' function. The 'tbl' contains transformed values by one of the ordination methods.
ordinationPlot( tbl, se, highlight = c("none", colnames(colData(se))), explainedVar = NULL, x_coord, y_coord, height = 600 )
tbl |
'tbl' as obtained by the function 'ordination' |
se |
'SummarizedExperiment' |
highlight |
'character', one of '"none"' or 'colnames(colData(se))' |
explainedVar |
NULL or named 'numeric', if 'numeric' 'explainedVar' contains the explained variance per principal component (names of 'explainedVar' corresponds to the principal components) |
x_coord |
'character', column name of 'tbl' that stores x coordinates |
y_coord |
'character', column name of 'tbl' that stores y coordinates |
height |
'numeric', specifying the height of the plot (in pixels) |
The function 'ordinationPlot' is a wrapper for a 'ggplot'/'ggplotly' expression.
'plotly'
Thomas Naake
library(SummarizedExperiment) ## create se a <- matrix(1:100, nrow = 10, ncol = 10, byrow = TRUE, dimnames = list(1:10, paste("sample", 1:10))) set.seed(1) a <- a + rnorm(100) cD <- data.frame(name = colnames(a), type = c(rep("1", 5), rep("2", 5))) rD <- data.frame(spectra = rownames(a)) se <- SummarizedExperiment(assay = a, rowData = rD, colData = cD) pca <- ordination(x = assay(se), type = "PCA", params = list()) ordinationPlot(tbl = pca, se = se, highlight = "type", x_coord = "PC1", y_coord = "PC2")