Heat Maps Explained
Heat maps use color to show patterns in large datasets. They're powerful for spotting trends, outliers, and clusters instantly - but only when designed correctly.
What Is a Heat Map?
Definition: A grid where each cell is colored based on its value
Example: Website traffic by day and hour
Mon Tue Wed Thu Fri Sat Sun
9AM π¦ π¦ π¦ π¦ π¦ π© π©
12PM π¨ π¨ π¨ π¨ π¨ π§ π§
3PM π§ π§ π§ π§ π§ π₯ π₯
6PM π₯ π₯ π₯ π₯ π₯ π¨ π¨
Pattern instantly visible: Weekends have different traffic, 3PM-6PM busiest
When to Use Heat Maps
β Perfect For
1. Matrix Data (Two Dimensions)
- Time patterns: Day of week Γ Hour of day
- Correlations: Variable A Γ Variable B relationships
- Performance grids: Sales rep Γ Product category
- Survey results: Question Γ Demographic group
2. Spotting Patterns
Great for finding:
β
Hot spots (high activity areas)
β
Cold spots (low activity areas)
β
Clusters and groupings
β
Anomalies and outliers
β
Periodicity (daily/weekly patterns)
3. Large Datasets
When you have too many data points for bar/line charts (50+ cells), heat maps condense information effectively.
β Don't Use Heat Maps For
- β Precise value reading - Humans can't distinguish 47% from 49% by color
- β Small datasets - 3x3 grid? Use a table instead
- β Single dimension data - Use bar chart
- β Categories without natural order - Alphabetical product names don't work well
Types of Heat Maps
1. Calendar Heat Map
Best for: Activity over time (days/weeks/months)
Example: GitHub contribution graph
- Rows = weeks
- Columns = days of week
- Color = number of commits
Use case: Exercise tracking, sales patterns, user activity
2. Correlation Matrix Heat Map
Best for: Showing relationships between multiple variables
Example: Stock correlations
AAPL MSFT GOOG AMZN
AAPL 1.0 0.8 0.7 0.6
MSFT 0.8 1.0 0.9 0.7
GOOG 0.7 0.9 1.0 0.8
AMZN 0.6 0.7 0.8 1.0
Red = highly correlated, Blue = not correlated
3. Geographic Heat Map
Best for: Density visualization on maps
Examples: Crime hotspots, customer concentrations, weather patterns
Note: Different from choropleth maps (which color regions by value)
4. Cluster Heat Map
Best for: Showing hierarchical groupings
Use case: Gene expression data, customer segmentation, product similarities
Special feature: Rows/columns reordered to group similar items together
Choosing the Right Color Scale
| Data Type | Color Scale | Example |
|---|---|---|
| Sequential (low to high) | Single hue gradient | Light blue β Dark blue |
| Diverging (with midpoint) | Two-hue diverging | Red β White β Blue |
| Categorical (distinct groups) | Distinct colors | Red, Blue, Green, Yellow |
Sequential Scale: Low β High
Use when: Data goes from minimum to maximum with no meaningful center
β
Good for:
- Sales volume (0 to max)
- Population density
- Temperature (all positive)
- Website traffic
Color choice:
- Light = low values
- Dark = high values
- Single hue: Blue, Green, or Purple work well
Diverging Scale: Below/Above a Midpoint
Use when: Data has a meaningful center (zero, average, target)
β
Good for:
- Profit/loss (negative to positive)
- Performance vs target
- Correlation (-1 to +1)
- Temperature change (above/below average)
Color choice:
- Red for negative/below
- White/light for center
- Blue for positive/above
Color Best Practices
β Do This
- β Use colorblind-safe palettes - Avoid red-green
- β Include a legend with min/max values clearly labeled
- β Use enough color steps - 5-9 distinct shades work best
- β Make low/high values obvious - High contrast between extremes
- β Test in grayscale - Pattern should still be visible
β Don't Do This
- β Rainbow colors - Redβyellowβgreen is terrible for heat maps
- β Red-green diverging - 8% of men are colorblind to this
- β Too few shades - Only 3 colors = hard to see nuance
- β Too many shades - 20+ colors = impossible to distinguish
- β Inverted expectations - Don't make red = good, green = bad
Design Best Practices
1. Order Matters
β
Good ordering:
- Chronological (time on one axis)
- Natural order (Monday β Sunday)
- Sorted by value (highest to lowest)
- Clustered by similarity
β Bad ordering:
- Alphabetical (unless meaningful)
- Random
- No pattern
2. Labels Must Be Readable
- Horizontal labels: Left-aligned text
- Vertical labels: Rotate 90Β° or use abbreviated names
- Cell size: Large enough to distinguish colors (min 20Γ20px)
- Borders: Thin gray lines help separate cells
3. Add Interactivity (If Possible)
Enhance with:
β
Hover tooltips showing exact values
β
Click to filter/drill down
β
Zoom for large matrices
β
Toggle between absolute/relative values
4. Context is Critical
- Title: Clearly state what's being measured
- Axis labels: Name both dimensions
- Legend: Show scale with min/max/units
- Notes: Explain missing data or outliers
Common Heat Map Mistakes
β Mistake #1: Using the Wrong Scale
Bad: Sequential scale for profit/loss data
Result: Can't distinguish positive from negative
Fix: Use diverging scale with zero as midpoint
β Mistake #2: Not Handling Outliers
Problem: One extreme value makes everything else the same color
Solution:
- Use log scale
- Cap maximum at 95th percentile
- Mark outliers separately
- Use two heat maps (normal + outliers)
β Mistake #3: Too Many Cells
Bad: 100Γ100 grid = 10,000 cells
Result: Individual cells too small to see
Fix:
- Aggregate data (hourly β daily)
- Show top N rows/columns
- Use interactive zoom
- Consider alternative visualization
β Mistake #4: Inconsistent Bin Sizes
Bad legend:
0-10, 10-25, 25-100, 100-500
(Unequal ranges make interpretation hard)
Good legend:
0-25, 25-50, 50-75, 75-100
(Equal ranges, easier to understand)
Practical Examples
Example 1: Customer Activity Heat Map
Scenario: E-commerce site traffic
Rows: Days of week (Mon-Sun)
Columns: Hours (0-23)
Color: Number of purchases (0 = white, 100+ = dark red)
Insights revealed:
- Weekend mornings are dead
- Weekday lunch hours spike
- Thursday evenings highest
β Schedule sales/promotions accordingly
Example 2: Product Performance Heat Map
Scenario: Sales by category and region
Rows: Product categories (Electronics, Clothing, Home, etc.)
Columns: Regions (North, South, East, West)
Color: Revenue (low = light blue, high = dark blue)
Insights revealed:
- Electronics dominate North
- Clothing strong in all regions
- Home goods weak in West
β Adjust inventory by region
Alternatives to Consider
Heat maps aren't always the answer. Consider these instead:
| If You Need | Use Instead |
|---|---|
| Exact values | Table with conditional formatting |
| Small dataset (< 20 cells) | Bar chart or table |
| Single dimension | Bar chart or line chart |
| Geographic distribution | Choropleth map |
Quick Checklist Before Publishing
- β Color scale matches data type (sequential vs diverging)
- β Legend includes min/max values and units
- β Both axes clearly labeled
- β Cell ordering is meaningful (not random)
- β Colorblind-safe palette used
- β Outliers handled appropriately
- β Cell size large enough to distinguish colors
- β Title explains what's being shown
- β Missing data is indicated (not just white)
Golden Rule: Heat maps are for spotting patterns, not reading exact values. If your audience needs precise numbers, add tooltips or use a table instead. If the pattern doesn't jump out within 3 seconds, your color scale or ordering is wrong.