Heat Maps Explained

⏱️ 30 sec read 📊 Visualization

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)

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

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

❌ Don't Do This

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

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

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

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.

← Back to Visualization Tips