.hclustv_profiles_heatmap

proteopy.pl.hclustv_profiles_heatmap(adata, selected_vars=None, group_by=None, summary_method='median', linkage_method='average', distance_metric='euclidean', layer=None, zero_to_na=False, fill_na=None, skip_na=True, cmap='coolwarm', margin_color=False, order_by=None, order=None, color_scheme=None, row_cluster=True, col_cluster=True, xticklabels=True, yticklabels=False, figsize=(10.0, 8.0), title=None, show=True, ax=False, save=None)[source]

Plot a clustered heatmap of variable profiles across samples or groups.

Computes z-scores for each variable across samples (or group summaries), then applies hierarchical clustering to visualize variable expression patterns.

Parameters:
  • adata (AnnData) – AnnData with proteomics annotations.

  • selected_vars (list[str] | None) – Explicit list of variables to include. When None, all variables are used.

  • group_by (str | None) – Column in adata.obs used to group observations. When provided, computes a summary statistic for each group rather than showing individual samples.

  • summary_method (str) – Method for computing group summaries when group_by is specified. One of "median" or "mean" (alias "average").

  • linkage_method (str) – Linkage criterion passed to scipy.cluster.hierarchy.linkage().

  • distance_metric (str) – Distance metric for clustering. One of "euclidean", "manhattan", or "cosine".

  • layer (str | None) – Optional adata.layers key to draw quantification values from. When None the primary matrix adata.X is used.

  • zero_to_na (bool) – Replace zeros with NaN before computing profiles.

  • fill_na (float | int | None) – Replace NaN values with the specified constant.

  • skip_na (bool) – Skip NaN values when computing group summaries and z-scores.

  • cmap (str) – Colormap for the heatmap body.

  • margin_color (bool) – Add a color bar between the column dendrogram and the heatmap. When True, colors by sample (if group_by is None) or by group (if group_by is set).

  • order_by (str | None) – Column in adata.obs used to order samples (columns). When set, automatically disables column clustering and orders columns by the values of this column. Also displays a margin color bar colored by this column. Cannot be used with group_by.

  • order (str | list | None) – The order by which to present samples, groups, or categories. If order_by is None and order is None, the existing order is used. If order_by is None and order is not None, order specifies the column order (samples or groups). If order_by is not None and order is None, the unique values in order_by are used (categorical order if categorical, sorted order otherwise). If order_by is not None and order is not None, order defines the order of the unique order_by values. Values not in order are excluded.

  • color_scheme (str | dict | Sequence | Colormap | None) – Palette specification for the margin color bar, forwarded to proteopy.utils.matplotlib._resolve_color_scheme(). Ignored when neither margin_color nor order_by is set.

  • row_cluster (bool) – Perform hierarchical clustering on variables (rows).

  • col_cluster (bool) – Perform hierarchical clustering on samples/groups (columns).

  • xticklabels (bool) – Show x-axis tick labels (sample/group names).

  • yticklabels (bool) – Show y-axis tick labels (variable names).

  • figsize (tuple[float, float]) – Matplotlib figure size in inches.

  • title (str | None) – Title for the plot.

  • show (bool) – Display the figure with matplotlib.pyplot.show().

  • ax (bool) – Return the heatmap matplotlib.axes.Axes when True.

  • save (str | Path | None) – File path for saving the figure.

Returns:

Heatmap axes when ax is True; otherwise None.

Return type:

Axes or None