scpdac.pl.plot_label_distribution

scpdac.pl.plot_label_distribution#

scpdac.pl.plot_label_distribution(adata, key='predicted_celltype', *, ax=None)#

Plot a horizontal bar chart of the value counts of an obs column.

Handy for inspecting the output of scpdac.tl.predict_labels().

Parameters:
  • adata (AnnData) – AnnData whose obs[key] will be summarised.

  • key (str (default: 'predicted_celltype')) – The obs column to count (e.g. "predicted_celltype" or "predicted_malignant").

  • ax (default: None) – Optional Matplotlib axis to draw on; created if not provided.

Returns:

The Matplotlib axis containing the plot.

Raises:

KeyError – If key is not present in adata.obs.