Description Usage Arguments Details Value Examples
View source: R/plot_hexbin_meta.R
Plot of meta data of single cell data in bivariate hexagon cells.
1 2 3 4 5 6 7 8 9 10 11 |
sce |
A |
col |
A string referring to the name of one column in the meta data of sce by which to colour the hexagons. |
action |
A string specifying how meta data of observations in
binned hexagon cells are to be summarized. Possible actions are
|
no |
An integer specifying which level to plot of the column. Only in
effect when |
colors |
A vector of strings specifying which colors to use for plotting
the different levels in the selected column of the meta data. Only in
effect when the selected |
title |
A string containing the title of the plot. |
xlab |
A string containing the title of the x axis. |
ylab |
A string containing the title of the y axis. |
na.rm |
Logical indicating whether NA values should be removed. |
This function plots any column of the meta data in the hexagon cell
representation calculated with make_hexbin
. The chosen meta
data column is summarized by one of six actions majority
,
prop
, prop_0
, mode
, mean
and median
:
majority
Returns the value of the majority of observations in the bin. The associated meta data column needs to be a factor or character.
prop
Returns the proportion of each level or unique character in the bin. The associated meta data column needs to be a factor or character.
prop_0
Returns the proportion of observations in the bin greater than 0. The associated meta data column needs to be numeric.
mode
Returns the mode of the observations in the bin. The associated meta data column needs to be numeric.
mean
Returns the mean of the observations in the bin. The associated meta data column needs to be numeric.
median
Returns the median of the observations in the bin. The associated meta data column needs to be numeric.
A ggplot2{ggplot}
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #' # For Seurat object
library(Seurat)
data("pbmc_small")
pbmc_small <- make_hexbin(pbmc_small, 10, dimension_reduction = "PCA")
plot_hexbin_meta(pbmc_small, col="RNA_snn_res.1", action="prop", no=1)
# For SingleCellExperiment object
## Not run:
library(TENxPBMCData)
library(scater)
tenx_pbmc3k <- TENxPBMCData(dataset = "pbmc3k")
rm_ind <- calculateAverage(tenx_pbmc3k) < 0.1
tenx_pbmc3k <- tenx_pbmc3k[-rm_ind, ]
colData(tenx_pbmc3k) <- cbind(
colData(tenx_pbmc3k),
perCellQCMetrics(tenx_pbmc3k)
)
tenx_pbmc3k <- logNormCounts(tenx_pbmc3k)
tenx_pbmc3k <- runPCA(tenx_pbmc3k)
tenx_pbmc3k <- make_hexbin(tenx_pbmc3k, 20, dimension_reduction = "PCA")
plot_hexbin_meta(tenx_pbmc3k, col = "total", action = "median")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.