scHopfield.plotting.plot_interaction_matrix

scHopfield.plotting.plot_interaction_matrix(adata: AnnData, cluster: str, top_n: int | None = None, sort_by: str = 'degree', ax: Axes | None = None, cmap: str = 'RdBu_r', show_labels: bool = True, label_fontsize: int = 8, **kwargs) Axes[source]

Plot interaction matrix heatmap.

Parameters:
  • adata (AnnData) – Annotated data object with fitted interactions

  • cluster (str) – Cluster name

  • top_n (int, optional) – Number of top genes to show. If None, shows all genes.

  • sort_by (str, optional (default: 'degree')) – How to select top genes: ‘degree’ (sum of absolute weights), ‘variance’ (variance of weights), or ‘none’ (original order)

  • ax (plt.Axes, optional) – Axes to plot on. If None, creates new figure.

  • cmap (str, optional (default: 'RdBu_r')) – Colormap for the heatmap

  • show_labels (bool, optional (default: True)) – Whether to show gene name labels on axes

  • label_fontsize (int, optional (default: 8)) – Font size for gene labels

  • **kwargs – Additional keyword arguments for imshow (e.g., vmin, vmax)

Returns:

Axes with plot

Return type:

plt.Axes