Creating Heatmaps
Creating Heatmaps
Heatmaps use color to represent values in a matrix, making patterns and relationships immediately visible. They're essential for correlation analysis, confusion matrices, and many other applications.
Basic Heatmap
Loading Python Playground...
Adding Value Annotations
Loading Python Playground...
Diverging Colormaps
For data with a meaningful center (e.g., change from baseline):
Loading Python Playground...
Calendar Heatmap
Loading Python Playground...
Custom Color Normalization
Loading Python Playground...
Practice: Create a Performance Heatmap
Loading Python Exercise...
Key Takeaways
- Heatmaps visualize matrix data using color intensity
- Use
imshow()for basic heatmaps - Add annotations with
ax.text()for each cell - Choose text color based on background for readability
- Diverging colormaps for data with meaningful center
- Use percentile normalization to handle outliers
- Always add a colorbar to explain the color scale
In the next lesson, we'll explore correlation matrices and their visualization.

