.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) –
AnnDatawith 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.obsused 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_byis 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.layerskey to draw quantification values from. WhenNonethe primary matrixadata.Xis used.zero_to_na (bool) – Replace zeros with
NaNbefore computing profiles.fill_na (float | int | None) – Replace
NaNvalues with the specified constant.skip_na (bool) – Skip
NaNvalues 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 (ifgroup_byisNone) or by group (ifgroup_byis set).order_by (str | None) – Column in
adata.obsused 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 withgroup_by.order (str | list | None) – The order by which to present samples, groups, or categories. If
order_byisNoneandorderisNone, the existing order is used. Iforder_byisNoneandorderis notNone,orderspecifies the column order (samples or groups). Iforder_byis notNoneandorderisNone, the unique values inorder_byare used (categorical order if categorical, sorted order otherwise). Iforder_byis notNoneandorderis notNone,orderdefines the order of the uniqueorder_byvalues. Values not inorderare 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 neithermargin_colornororder_byis 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.AxeswhenTrue.save (str | Path | None) – File path for saving the figure.
- Returns:
Heatmap axes when
axisTrue; otherwiseNone.- Return type:
Axes or None