plotScatter: Scatter plot

Description Usage Arguments Value Author(s) Examples

View source: R/plotScatter.R

Description

Bivariate scatter plots including visualization of (group-specific) gates, their boundaries and percentage of selected cells.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotScatter(
  x,
  chs,
  color_by = NULL,
  facet_by = NULL,
  bins = 100,
  assay = "exprs",
  label = c("target", "channel", "both"),
  zeros = FALSE,
  k_pal = CATALYST:::.cluster_cols
)

Arguments

x

a SingleCellExperiment.

chs

character string pecifying which channels to plot. Valid values are antigens: rownames(x), channel names: channels(x) or non-mass channels stored in names([int_]colData(x)), and should correspond to numeric variables.

color_by

character string specifying a cell metadata column to color by; valid values are names(colData(x)), names(int_colData(x)); names(cluster_codes(x)) (if cluster has been run); or NULL to color by density.

facet_by

character string specifying a non-numeric cell metadata column to facet by; valid values are names(colData(x)). When length(chs) == 1, 2 facetting variables may be provided, otherwise 1 only.

bins

numeric of length 1 giving the number of bins for geom_hex when coloring by density.

assay

character string specifying which assay data to use. Should be one of assayNames(x).

label

character string specifying axis labels should include antigen targets, channel names, or a concatenation of both.

zeros

logical specifying whether to include 0 values.

k_pal

character string specifying the cluster color palette; ignored when color_by is not one of names(cluster_codes(x)). If less than nlevels(cluster_ids(x, k)) are supplied, colors will be interpolated via colorRampPalette.

Value

a ggplot object.

Author(s)

Helena L Crowell helena.crowell@uzh.ch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(raw_data)
sce <- prepData(raw_data)

dna_chs <- c("DNA1", "DNA2")
plotScatter(sce, dna_chs, label = "both")

plotScatter(sce, 
  chs = sample(rownames(sce), 4), 
  color_by = "sample_id")
  
sce <- prepData(sample_ff)  
ids <- sample(rownames(sample_key), 3)
sce <- assignPrelim(sce, sample_key[ids, ])
sce <- sce[, sce$bc_id %in% ids]

chs <- sample(rownames(sce), 5)
plotScatter(sce, chs, color_by = "bc_id")
plotScatter(sce, chs, color_by = "delta")

CATALYST documentation built on Nov. 8, 2020, 6:53 p.m.