scHopfield.plotting.plot_energy_boxplots

scHopfield.plotting.plot_energy_boxplots(adata: AnnData, cluster_key: str = 'cell_type', order: List[str] | None = None, plot_energy: str = 'all', colors: List | Dict | None = None, palette: str | None = None, show_points: bool = False, **fig_kws) ndarray | Axes[source]

Plot energy distributions for different clusters using boxplots.

Parameters:
  • adata (AnnData) – Annotated data object with computed energies

  • cluster_key (str, optional (default: 'cell_type')) – Key in adata.obs for cluster labels

  • order (list, optional) – Order of clusters to display in the boxplots

  • plot_energy (str, optional (default: 'all')) – Which energy to plot: ‘all’, ‘total’, ‘interaction’, ‘degradation’, or ‘bias’

  • colors (list or dict, optional) – Colors for each cluster. Overrides palette.

  • palette (str, optional) – Seaborn palette name (e.g., ‘Set2’, ‘husl’, ‘tab10’)

  • show_points (bool, optional (default: False)) – If True, overlay individual points as strip plot

  • **fig_kws – Additional keyword arguments for plt.subplots()

Returns:

Array of axes (if plot_energy=’all’) or single axes

Return type:

np.ndarray or plt.Axes

Examples

>>> import scHopfield as sch
>>> sch.pl.plot_energy_boxplots(adata, cluster_key='cell_type')
>>> sch.pl.plot_energy_boxplots(adata, plot_energy='interaction', palette='Set2')