plotCellComposition: Bar plot of cell compositions

plotCellCompositionR Documentation

Bar plot of cell compositions

Description

Bar plot of cell compositions

Usage

plotCellComposition(obj, col, width = NULL)

## S4 method for signature 'SingleCellExperiment'
plotCellComposition(obj, col, width = NULL)

## S4 method for signature 'matrix'
plotCellComposition(obj, col, width = NULL)

## S4 method for signature 'data.frame'
plotCellComposition(obj, col, width = NULL)

Arguments

obj

matrix of [cells] x [samples] or SingleCellExperiment from aggregateToPseudoBulk

col

array of colors. If missing, use default colors. If names(col) is the same as arrayNames(obj), then colors will be assigned by assay name#'

width

specify width of bars

Value

Barplot showing cell fractions

Examples


library(muscat)
library(SingleCellExperiment)

data(example_sce)

# create pseudobulk for each sample and cell cluster
pb <- aggregateToPseudoBulk(example_sce,
  assay = "counts",
  cluster_id = "cluster_id",
  sample_id = "sample_id",
  verbose = FALSE
)

# show cell composition bar plots
plotCellComposition(pb)

# extract cell counts
df_cellCounts <- cellCounts(pb)

# show cell composition bar plots
plotCellComposition(df_cellCounts)


GabrielHoffman/dreamlet documentation built on May 20, 2024, 2:05 p.m.