troutpy.pl.gene_metric_heatmap

troutpy.pl.gene_metric_heatmap#

troutpy.pl.gene_metric_heatmap(sdata, metrics=None, probes_to_plot=None, title=None, cluster_axis='both', save=False, figures_path='', custom_plot_filename=None, cmap='coolwarm')#

Plot a heatmap or clustered heatmap of per-gene metrics.

Control probes are highlighted in the y-tick labels (when shown) by coloring them grey instead of black.

Parameters:
  • sdata (SpatialData) – SpatialData object that contains an xrna_metadata table with a var DataFrame.

  • metrics (Optional[list[str]] (default: None)) – Columns in sdata["xrna_metadata"].var to include as heatmap columns. If None, defaults to a fixed set of quality-control metrics.

  • probes_to_plot (Optional[list[str]] (default: None)) – If provided, restrict the heatmap to these probes/genes, and show y-tick labels if there are at most 20 of them.

  • title (Optional[str] (default: None)) – Title for the plot.

  • cluster_axis (str (default: 'both')) – Determines clustering: "none" (no clustering), "x" (cluster columns only), "y" (cluster rows only), or "both" (cluster rows and columns).

  • save (bool (default: False)) – Whether to save the figure.

  • figures_path (str (default: '')) – Directory path to save the figure.

  • custom_plot_filename (Optional[str] (default: None)) – Custom filename for saving the plot.

  • cmap (str (default: 'coolwarm')) – Colormap for the heatmap, resolved via troutpy.pl.get_colormap() if not a built-in Matplotlib colormap.

Return type:

None

Returns:

None