cellcharter.pl.nhood_enrichment

cellcharter.pl.nhood_enrichment#

cellcharter.pl.nhood_enrichment(adata, cluster_key, row_groups=None, col_groups=None, min_freq=None, annotate=False, transpose=False, method=None, title='Neighborhood enrichment', cmap='bwr', palette=None, cbar_kwargs=mappingproxy({}), figsize=None, dpi=None, ax=None, n_digits=2, significance=None, save=None, **kwargs)#

A modified version of squidpy’s function for plotting neighborhood enrichment.

The enrichment is computed by cellcharter.gr.nhood_enrichment().

Parameters:
  • adata (AnnData) – Annotated data object.

  • cluster_key (str) – Key in anndata.AnnData.obs where clustering is stored.

  • row_groups (Optional[list[str]] (default: None)) – Restrict the rows to these groups. If None, all groups are plotted.

  • col_groups (Optional[list[str]] (default: None)) – Restrict the columns to these groups. If None, all groups are plotted.

  • annotate (bool (default: False)) – Whether to annotate the cells of the heatmap.

  • method (Optional[str] (default: None)) – The linkage method to be used for dendrogram/clustering, see scipy.cluster.hierarchy.linkage().

  • title (str | None (default: 'Neighborhood enrichment')) – The title of the plot.

  • cmap (str (default: 'bwr')) – Continuous colormap to use.

  • cbar_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments for matplotlib.figure.Figure.colorbar().

  • palette (Union[str, ListedColormap, None] (default: None)) – Categorical colormap for the clusters. If None, use anndata.AnnData.uns ['{cluster_key}_colors'], if available.

  • figsize (Optional[tuple[float, float]] (default: None)) – Size of the figure in inches.

  • dpi (Optional[int] (default: None)) – Dots per inch.

  • save (Union[str, Path, None] (default: None)) – Whether to save the plot.

  • ax (Optional[Axes] (default: None)) – Axes, matplotlib.axes.Axes.

  • n_digits (int (default: 2)) – The number of digits of the number in the annotations.

  • significance (Optional[float] (default: None)) – Mark the values that are below this threshold with a star. If None, no significance is computed. It requires gr.nhood_enrichment to be run with pvalues=True.

  • kwargs (Any) – Keyword arguments for matplotlib.pyplot.text().

Return type:

None

Returns:

Nothing, just plots the figure and optionally saves the plot.