.sample_correlation_matrix

proteopy.pl.sample_correlation_matrix(adata, method='pearson', zero_to_na=False, layer=None, fill_na=None, margin_color=None, color_scheme=None, cmap='coolwarm', linkage_method='average', xticklabels=False, yticklabels=False, figsize=(9.0, 7.0), show=True, ax=False, save=None)[source]

Plot a clustered correlation heatmap across samples (obs).

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

  • method (str) – Correlation estimator passed to pandas.DataFrame.corr().

  • zero_to_na (bool) – Replace zeros with missing values before computing correlations.

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

  • fill_na (float | None) – Constant used to replace remaining NaN values prior to correlation. When None (default), a ValueError is raised if missing values are detected (suggesting fill_na=0).

  • margin_color (str | None) – Optional column in adata.obs used to color dendrogram labels.

  • color_scheme (Any) – Color palette specification understood by proteopy.utils.matplotlib._resolve_color_scheme().

  • cmap (str) – Continuous colormap for the heatmap body.

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

  • xticklabels (bool) – Whether to show x- and y-axis tick labels.

  • yticklabels (bool) – Whether to show x- and y-axis tick labels.

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

  • 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 Seaborn cluster map. When None nothing is written.

Returns:

Heatmap axes when ax is True; otherwise None.

Return type:

Axes or None

Raises:

ValueError – If the selected matrix still contains missing values after optional zero replacement and fill_na is None.