Block 38: Heatmaps & Correlation Matrices
Visualize multi-variable relationships in a grid.
Concepts
- Computing correlation: df.corr()
- sns.heatmap() with annot=True, cmap
- Masking the upper triangle
- Interpreting positive vs negative correlations
Code Examples
See exercise below.
Exercise
Create an annotated heatmap of the Iris correlation matrix. Mask the upper triangle of the heatmap for a cleaner look.
Homework
From the heatmap, which 2 features are most positively correlated? Does it make physical sense? Friday