celllabel_quant_stackedbar

besca.pl.celllabel_quant_stackedbar(adata, subset_variable, count_variable='celltype', plot_percentages=True, figsize=(8, 4))[source]

Generate a stacked bar plot of the percentage of labelcounts within each AnnData subset

Parameters:
  • adata (AnnData) – the AnnData object

  • subset_variable (str) – string identifying the column name of adata.obs along which the AnnData object should be subsetted

  • count_variable (str | default = ‘celltype’) – string identiyfing the column of adata.obs containing the labels to be counted

  • plot_percentages (bool | default = True) – boolian indicating if the percentages or the total counts should be plotted

  • figsize ((width, height) or None | default = (8,4)) – optional parameter to define the figure size of the plot that is to be generated

Return type:

Figure

Example

>>> import besca as bc
>>> adata = bc.datasets.simulated_Kotliarov2020_processed()
>>> adata.obs   = adata.obs.astype( {'batch' :  'category'})
>>> fig = bc.pl.celllabel_quant_stackedbar(adata, count_variable = 'leiden', subset_variable = 'donor')