A clustermap is a heatmap that runs hierarchical clustering on the rows and columns and reorders them, so similar rows and columns sit together — revealing blocks and patterns a plain heatmap hides.
clustermap
sns.clustermap(data, cmap="viridis",standard_scale=1, # scale columns to 0–1 so none dominatesfigsize=(10, 10))# dendrograms on the edges show how rows/columns were grouped
Key takeaways
- 01clustermap clusters and reorders rows/columns so similar ones sit together.
- 02Dendrograms on the edges show the grouping hierarchy.
- 03Scale the data (standard_scale/z_score) so no column dominates the clustering.
- 04It's an exploratory tool for finding structure in a matrix.
