troutpy.pl.heatmap

Contents

troutpy.pl.heatmap#

troutpy.pl.heatmap(data, output_path='', save=False, figsize=None, tag='', title=None, cmap='RdBu_r', annot=False, cbar=True, vmax=None, vmin=0, row_cluster=True, col_cluster=True)#

Generate a clustered heatmap from the given data and optionally save it to a file.

Parameters:
  • data (DataFrame) – The data to visualize as a heatmap. Rows and columns will be clustered if specified.

  • output_path (str (default: '')) – Directory where the heatmap should be saved if save is True.

  • save (bool (default: False)) – Whether to save the generated heatmap to a file.

  • figsize (Optional[tuple[float, float]] (default: None)) – Size of the figure as (width, height). If None, the size is calculated based on the data dimensions.

  • tag (str (default: '')) – A tag to append to the saved file name.

  • title (Optional[str] (default: None)) – Title of the heatmap.

  • cmap (str (default: 'RdBu_r')) – Colormap to use for the heatmap.

  • annot (bool (default: False)) – Whether to annotate the heatmap cells with their values.

  • cbar (bool (default: True)) – Whether to display a color bar in the heatmap.

  • vmax (Optional[float] (default: None)) – Maximum value for the colormap.

  • vmin (float (default: 0)) – Minimum value for the colormap.

  • row_cluster (bool (default: True)) – Whether to perform hierarchical clustering on rows.

  • col_cluster (bool (default: True)) – Whether to perform hierarchical clustering on columns.

Return type:

None

Returns:

None

Notes

Clustering is performed using seaborn.clustermap().