Skip to main content
Albero Academy

Cluster Maps

A heatmap that reorders rows and columns to reveal structure.

Regression & Matrix7 min

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

reorder to find structure
sns.clustermap(data, cmap="viridis",
standard_scale=1, # scale columns to 0–1 so none dominates
figsize=(10, 10))
# dendrograms on the edges show how rows/columns were grouped

Key takeaways

  1. 01clustermap clusters and reorders rows/columns so similar ones sit together.
  2. 02Dendrograms on the edges show the grouping hierarchy.
  3. 03Scale the data (standard_scale/z_score) so no column dominates the clustering.
  4. 04It's an exploratory tool for finding structure in a matrix.

Finished this chapter?

Mark it complete to track your progress through Seaborn.