plotCounts {CATALYST} | R Documentation

## Plot cell counts

### Description

Barplot of the number of cells measured for each sample.

### Usage

    plotCounts(x, group_by = "condition", color_by = group_by, prop = FALSE)

### Arguments

`x` | a `SingleCellExperiment`.
`group_by` | character string specifying a non-numeric cell metadata column to group by (determines x-axis ticks); valid values are `names(colData(x))`.
`color_by` | character string specifying a non-numeric cell metadata column to color by (determines grouping of bars); valid values are `names(colData(x))`; NULL for no color.
`prop` | logical specifying whether to plot relative abundances (frequencies) for each group rather than total cell counts; bars will be stacked when `prop = TRUE` and dodged otherwise.

### Value

a `ggplot` object.

### Author(s)

Helena L Crowell helena.crowell@uzh.ch

### References

Nowicka M, Krieg C, Crowell HL, Weber LM et al. CyTOF workflow: Differential discovery in high-throughput high-dimensional cytometry datasets. F1000Research 2017, 6:748 (doi: 10.12688/f1000research.11622.1)

### Examples

    data(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)

    # plot number of cells per sample, colored by condition
    plotCounts(sce,
      group_by = "sample_id",
      color_by = "condition")

    # same as above, but order by patient
    plotCounts(sce,
      group_by = "patient_id",
      color_by = "condition")

    # total number of cell per patient
    plotCounts(sce,
      group_by = "patient_id",
      color_by = NULL)

    # plot proportion of cells from each patient by condition
    plotCounts(sce,
      prop = TRUE,
      group_by = "condition",
      color_by = "patient_id")

[Package CATALYST version 1.16.2 Index]