decoupler.pl.obsbar

Contents

decoupler.pl.obsbar#

decoupler.pl.obsbar(adata, y, hue=None, kw_barplot=None, **kwargs)#

Plot adata.obs metadata as a grouped barplot.

Parameters:
  • adata (AnnData) – Annotated data matrix with observations (rows) and features (columns).

  • y (str) – Column name in adata.obs to plot in y axis.

  • hue (str | None (default: None)) – Column name in adata.obs to color bars.

  • kw_barplot (dict | None (default: None)) – Keyword arguments passed to seaborn.barplot.

  • ax – An existing matplotlib.axes._axes.Axes instance to plot on. If None, a new figure and axes will be created.

  • figsize – Size of the figure in inches as (width, height).

  • dpi – Dots per inch for the figure resolution.

  • return_fig – If True, plotting methods should return the figure object instead of showing it.

  • save – If set, path to save the plot automatically to a file.

Return type:

None | Figure

Returns:

If return_fig=True, returns matplotlib.figure.Figure instance.

Example

import decoupler as dc

adata, net = dc.ds.toy()
dc.pl.obsbar(adata, y="sample", hue="sample")