plot_hexbin_meta {schex} | R Documentation |
Plot of meta data of single cell data in bivariate hexagon cells.
plot_hexbin_meta( sce, col, action, no = 1, colors = NULL, title = NULL, xlab = NULL, ylab = NULL ) ## S4 method for signature 'SingleCellExperiment' plot_hexbin_meta( sce, col, action, no = 1, colors = NULL, title = NULL, xlab = NULL, ylab = NULL ) ## S4 method for signature 'Seurat' plot_hexbin_meta( sce, col, action, no = 1, colors = NULL, title = NULL, xlab = NULL, ylab = NULL )
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. |
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.
SingleCellExperiment
: Plot of meta data into hexagon cell for
SingleCellExperiment object.
Seurat
: Plot of meta data into hexagon cell for
Seurat object.
#' # 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) plot_hexbin_meta(pbmc_small, col="RNA_snn_res.1", action="prop", no=2) # 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 <- normalize(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)