plot_hexbin_meta_plus: Plot of meta data with annotation of single cell data in...

Description Usage Arguments Details Value Examples

View source: R/plot_hexbin_meta_plus.R

Description

Plot of meta data with annotation of single cell data in bivariate hexagon cells.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plot_hexbin_meta_plus(
  sce,
  col1,
  col2,
  action,
  no = 1,
  colors = NULL,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  expand_hull = 3,
  na.rm = FALSE,
  ...
)

Arguments

sce

A SingleCellExperiment or Seurat-class object.

col1

A string referring to the name of one column in the meta data of sce by which to make the outlines. Note that this should be a factor or a character.

col2

A string referring to the name of one column in the meta data of sce specifying what to color hexagons by.

action

A string specifying how meta data as specified in col2 of observations in binned hexagon cells are to be summarized. Possible actions are prop, mode, mean and median (see details).

no

An integer specifying which level to plot of the column. Only in effect when action=prop.

colors

A vector of strings specifying which colors to use for plotting the different levels in the selected column of the meta data.

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.

expand_hull

A numeric value determining the expansion of the line marking different clusters.

na.rm

Logical indicating whether NA values should be removed.

...

Additional arguments passed on to ggforce{geom_mark_hull}.

Details

This function plots any meta data in the hexagon cell representation calculated with make_hexbin as well as at the same time representing outlines of clusters. The chosen gene expression is summarized by one of four actions prop_0, mode, mean and median:

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.

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.

Value

A ggplot2{ggplot} object.

Examples

1
2
3
4
5
6
7
8
9
#' # For Seurat object
library(Seurat)
data("pbmc_small")
pbmc_small <- make_hexbin(pbmc_small, 10, dimension_reduction = "PCA")
pbmc_small$RNA_snn_res.0.8 <- as.factor(pbmc_small$RNA_snn_res.0.8)
plot_hexbin_meta_plus(pbmc_small, col1="RNA_snn_res.0.8",
  col2="nCount_RNA", action="mean")
plot_hexbin_meta_plus(pbmc_small, col1="RNA_snn_res.0.8",
  col2="groups", action="prop", no=1)

schex documentation built on Nov. 8, 2020, 5:56 p.m.