sccoda.util.data_visualization.stackbar

sccoda.util.data_visualization.stackbar(y, type_names, title, level_names, figsize=None, dpi=100, cmap=<matplotlib.colors.ListedColormap object>, plot_legend=True)

Plots a stacked barplot for one (discrete) covariate Typical use (only inside stacked_barplot): plot_one_stackbar(data.X, data.var.index, “xyz”, data.obs.index)

Parameters
y : ndarrayndarray

The count data, collapsed onto the level of interest. i.e. a binary covariate has two rows, one for each group, containing the count mean of each cell type

type_names : List[str]List[str]

The names of all cell types

title : strstr

Plot title, usually the covariate’s name

level_names : List[str]List[str]

names of the covariate’s levels

figsize : Tuple[int, int], NoneOptional[Tuple[int, int]] (default: None)

figure size

dpi : int, NoneOptional[int] (default: 100)

dpi setting

cmap : ListedColormap, NoneOptional[ListedColormap] (default: <matplotlib.colors.ListedColormap object at 0x7f132a83df40>)

The color map for the barplot

plot_legend : bool, NoneOptional[bool] (default: True)

If True, adds a legend

Return type

AxesAxes

Returns

  • Returns a plot

  • ax – a plot