View source: R/tab_samplesfeatures.R
mosaic | R Documentation |
The function mosaic
creates a mosaic plot of two factors from
an SummarizedExperiment
object. The columns f1
and f2
are taken from colData(se)
.
mosaic(se, f1, f2)
se |
|
f1 |
|
f2 |
|
Code partly taken from https://stackoverflow.com/questions/21588096/pass-string-to-facet-grid-ggplot2
gg
object from ggplot2
## create se
set.seed(1)
a <- matrix(rnorm(100), nrow = 10, ncol = 10,
dimnames = list(seq_len(10), paste("sample", seq_len(10))))
a[c(1, 5, 8), seq_len(5)] <- NA
cD <- data.frame(name = colnames(a),
type = c(rep("1", 5), rep("2", 5)),
cell_type = c("A", "B"))
rD <- data.frame(spectra = rownames(a))
se <- SummarizedExperiment::SummarizedExperiment(assay = a,
rowData = rD, colData = cD)
mosaic(se, "cell_type", "type")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.