decoupler.pl.obsm

Contents

decoupler.pl.obsm#

decoupler.pl.obsm(adata, key='rank_obsm', names=None, nvar=10, dendrogram=True, thr_sign=0.05, titles=None, cmap_stat='Purples', cmap_obsm='BrBG', cmap_obs=None, **kwargs)#

Plot metadata associations with features in adata.obsm.

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

  • key (str (default: 'rank_obsm')) – Name of adata.uns key storing decoupler.tl.rank_obsm results.

  • names (str | list | None (default: None)) – Which metadata covariates to show.

  • nvar (int | str | list | None (default: 10)) – How many features from adata.obsm to show.

  • dendogram – Whether to sort and plot samples using a dendogram.

  • thr_sign (float (default: 0.05)) – Threshold of significance for the adjusted p-values.

  • titles (list | None (default: None)) – List of titles to place for the metadata heatmap and obsm features.

  • cmap_stat (str (default: 'Purples')) – Colormap for metadata statistics.

  • cmap_obsm (str (default: 'BrBG')) – Colormap for obsm features.

  • cmap_obs (dict | None (default: None)) – Dictionary of colormaps containing a palette for each metadata covariate being plotted.

  • 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
import scanpy as sc

adata, net = dc.ds.toy()
sc.pp.scale(adata)
sc.tl.pca(adata)
dc.tl.rankby_obsm(adata, key="X_pca")
dc.pl.obsm(adata=adata, nvar=5)