View source: R/tab_dimensionreduction.R
dimensionReductionPlot | R Documentation |
dimensionReduction
valuesThe function dimensionReductionPlot
creates a dimension reduction plot.
The function takes as input the tbl
object obtained
from the dimensionReduction
function. The tbl
contains
transformed values by one of the dimension reduction methods.
dimensionReductionPlot(
tbl,
se,
color = c("none", colnames(se@colData)),
size = c("none", colnames(se@colData)),
explainedVar = NULL,
x_coord,
y_coord,
height = 600,
interactive = TRUE
)
tbl |
|
se |
|
color |
|
size |
|
explainedVar |
NULL or named |
x_coord |
|
y_coord |
|
height |
|
interactive |
|
The function dimensionReductionPlot
is a wrapper for a
ggplot/ggplotly
expression.
plotly
or gg
Thomas Naake
library(SummarizedExperiment)
## create se
a <- matrix(seq_len(100), nrow = 10, ncol = 10, byrow = TRUE,
dimnames = list(seq_len(10), paste("sample", seq_len(10))))
set.seed(1)
a <- a + rnorm(100)
cD <- data.frame(name = colnames(a), type = c(rep("1", 5), rep("2", 5)),
median_vals = apply(a, 2, median))
rD <- data.frame(spectra = rownames(a))
se <- SummarizedExperiment(assay = a, rowData = rD, colData = cD)
pca <- dimensionReduction(x = assay(se), type = "PCA", params = list())[[1]]
dimensionReductionPlot(tbl = pca, se = se, color = "type", size = "median_vals",
x_coord = "PC1", y_coord = "PC2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.