# Weekly Website Traffic Heatmap
## 1. Parsed Data Table
Synthesized hourly traffic (visits) anchored on given samples: Mon 9am=1200, Mon 2pm=1450, Mon 3am=45, Sat 11am=890, Sun 8pm=670.
| Day | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|-----|----|----|----|----|----|----|-----|-----|------|------|------|------|------|------|------|------|------|------|-----|-----|-----|-----|-----|-----|
| Mon | 80 | 55 | 48 | 45 | 50 | 90 | 300 | 650 | 1050 | 1200 | 1150 | 1050 | 980 | 1150 | 1450 | 1380 | 1200 | 950 | 720 | 560 | 480 | 360 | 240 | 140 |
| Tue | 85 | 58 | 50 | 46 | 52 | 95 | 310 | 660 | 1080 | 1220 | 1170 | 1080 | 1000 | 1170 | 1470 | 1400 | 1220 | 970 | 730 | 570 | 490 | 370 | 245 | 145 |
| Wed | 82 | 56 | 49 | 45 | 51 | 92 | 305 | 655 | 1060 | 1210 | 1160 | 1060 | 990 | 1160 | 1460 | 1390 | 1210 | 960 | 725 | 565 | 485 | 365 | 242 | 142 |
| Thu | 88 | 60 | 52 | 48 | 54 | 98 | 315 | 670 | 1090 | 1230 | 1180 | 1090 | 1010 | 1180 | 1480 | 1410 | 1230 | 980 | 740 | 580 | 500 | 380 | 250 | 150 |
| Fri | 90 | 62 | 54 | 50 | 56 |100 | 320 | 680 | 1100 | 1240 | 1190 | 1100 | 1020 | 1190 | 1490 | 1420 | 1240 | 990 | 760 | 610 | 540 | 420 | 280 | 170 |
| Sat |180 |120 | 80 | 60 | 55 | 70 | 150 | 350 | 600 | 820 | 870 | 890 | 860 | 830 | 800 | 780 | 760 | 720 | 680 | 640 | 600 | 540 | 420 | 260 |
| Sun |200 |130 | 85 | 62 | 58 | 72 | 140 | 320 | 560 | 780 | 830 | 850 | 820 | 790 | 760 | 740 | 720 | 690 | 680 | 675 | 670 | 580 | 450 | 280 |
## 2. ASCII Heatmap
Quintile thresholds (approx.): Q1≤95, Q2≤500, Q3≤780, Q4≤1110, Q5>1110
Legend: `·` very low `░` low `▒` medium `▓` high `█` peak
```
Hour: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-----------------------------------------------------------------
Mon | · · · · · · ░ ▒ ▓ █ ▓ ▓ ▓ █ █ █ █ ▓ ▒ ▒ ░ ░ ░ ░
Tue | · · · · · · ░ ▒ ▓ █ ▓ ▓ ▓ █ █ █ █ ▓ ▒ ▒ ░ ░ ░ ░
Wed | · · · · · · ░ ▒ ▓ █ ▓ ▓ ▓ █ █ █ █ ▓ ▒ ▒ ░ ░ ░ ░
Thu | · · · · · · ░ ▒ ▓ █ ▓ ▓ ▓ █ █ █ █ ▓ ▒ ▒ ▒ ░ ░ ░
Fri | · · · · · █ ░ ▒ ▓ █ ▓ ▓ ▓ █ █ █ █ ▓ ▒ ▒ ▒ ░ ░ ░
Sat | ░ ░ · · · · ░ ░ ▒ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▒ ▒ ▒ ▒ ▒ ▒ ░ ░
Sun | ░ ░ · · · · ░ ░ ▒ ▓ ▓ ▓ ▓ ▓ ▓ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ░ ░
```
## 3. Key Insights
- **Dual weekday peaks (█):** Sharp morning spike at 9am and a larger afternoon peak 1–4pm on Mon–Fri, with Fri 2pm being the single busiest hour (~1490).
- **Deep overnight coldspot (·):** 1am–5am on weekdays registers <100 visits — ideal window for deployments, maintenance, or batch jobs.
- **Weekend flattening:** Sat/Sun lack the sharp 9am/2pm peaks; traffic is smoother, plateaus 10am–1pm, and late evenings stay elevated (Sun 8pm≈670).
- **Night-owl weekend behavior:** Sat/Sun midnight–2am traffic is 2–3× higher than weekday equivalents, suggesting leisure browsing patterns.
- **Ramp-up window:** Traffic surges ~7× between 6am and 9am on weekdays — a critical auto-scaling trigger point.
## 4. Python Code
```python
import numpy as np
import
Generate Heatmaps Automatically Using AI
Tested prompts for ai heatmap generator compared across 5 leading AI models.
If you searched 'ai heatmap generator,' you probably have a dataset, a grid, or a matrix of values and you need to turn it into a visual heatmap fast, without firing up Python, installing matplotlib, or waiting on a data analyst. AI models like GPT-4, Claude, and Gemini can generate heatmap code, SVG markup, or structured color-mapped tables from plain-language descriptions of your data in seconds.
The core problem this solves: heatmaps require mapping numerical ranges to color scales, handling edge cases like nulls or outliers, and producing output a non-technical stakeholder can actually read. Doing that manually in a spreadsheet is tedious. Commissioning a BI dashboard for a one-off analysis is overkill. An AI prompt bridges that gap by generating ready-to-use code or visual output from your raw data description.
This page shows you exactly what prompt to use, compares how four leading models handle the same heatmap task, and explains when AI-generated heatmaps are the right call versus when you need a dedicated tool. If you have numbers and need colors, start here.
When to use this
This approach fits best when you have structured tabular data and need a heatmap quickly for a report, presentation, or internal review. It is ideal for one-off analyses where standing up a BI tool is impractical, or when you want to generate Python, R, or JavaScript code you can drop directly into an existing workflow.
- Turning a correlation matrix from a survey or experiment into a color-coded visual for a stakeholder slide deck
- Generating Python (seaborn/matplotlib) or R (ggplot2) heatmap code from a described dataset without writing it from scratch
- Creating a website engagement heatmap layout based on click-count data exported from analytics tools like GA4 or Hotjar CSVs
- Visualizing a confusion matrix from a machine learning model evaluation as a labeled, color-scaled heatmap
- Building a geographic or calendar heatmap (e.g., sales by day-of-week and hour) for a quick internal business review
When this format breaks down
- When your dataset has more than a few hundred rows and columns: AI models hit context limits and will truncate or hallucinate values, producing a heatmap that does not reflect your real data.
- When you need a real-time or interactive heatmap updating from a live data source: AI generates static code or output and cannot connect to databases or streaming feeds on its own.
- When pixel-accurate user behavior tracking (actual cursor movement, scroll depth, click coordinates on a webpage) is the goal: that requires instrumentation tools like Hotjar, Microsoft Clarity, or Crazy Egg, not a language model.
- When the output goes directly into a regulated or high-stakes report (medical, financial audit) without human validation: AI can misassign color scales or mislabel axes, and errors in those contexts carry real consequences.
The prompt we tested
You are an AI heatmap generator. Analyze the dataset or scenario provided and produce a clear, accurate heatmap representation with supporting insights. Instructions: Output in this exact order: Parsed Data Table, ASCII Heatmap with legend, Key Insights (bulleted, 3-5 points), and Python Code block. Use a 5-level intensity scale (·░▒▓█) mapped to quintiles of the data, keep the visualization under 80 characters wide, and ensure the Python code is runnable with clearly defined variables. Data / Scenario: Weekly website traffic by hour and day for the past week. Monday-Sunday rows, hours 0-23 columns. Peak traffic around 9am and 2pm weekdays, very low traffic 1am-5am. Sample values: Mon 9am=1200, Mon 2pm=1450, Mon 3am=45, Sat 11am=890, Sun 8pm=670. Generate the heatmap now, including: (1) a parsed data table, (2) an ASCII/Unicode heatmap visualization using color-intensity blocks (░▒▓█) or a gradient legend, (3) axis labels and a value-to-intensity legend, (4) 3-5 key insights highlighting hotspots, coldspots, and patterns, and (5) ready-to-use Python code (matplotlib/seaborn) that reproduces the heatmap from the data.
Model comparison
| Model | Quality | Cost | Latency | Tokens |
|---|---|---|---|---|
| Claude Opus 4.7 | 6 | $0.1608 | 23.5s | 481 / 2048 |
| Claude Haiku 4.5 | 7 | $0.0106 | 13.7s | 334 / 2048 |
| GPT-5.4 | 8 | $0.0315 | 25.4s | 300 / 2048 |
| Grok 4.1 Fast Reasoning | 7 | $0.0009 | 91.2s | 441 / 1563 |
Outputs
# Website Traffic Heatmap Analysis
## 1. Parsed Data Table
| Day | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|-----|---|---|---|---|---|---|---|---|---|---|----|----|----|----|----|----|----|----|----|----|----|----|----|---|
| Mon | 85| 45| 52| 48| 62| 78|120|380|950|1200|980|720|680|890|1450|1100|920|850|720|620|580|480|320|180|
| Tue | 90| 50| 55| 50| 65| 80|130|400|960|1180|970|730|690|900|1420|1090|930|860|730|630|590|490|330|190|
| Wed | 88| 48| 53| 49| 63| 79|125|390|955|1190|975|725|685|895|1440|1095|925|855|725|625|585|485|325|185|
| Thu | 92| 52| 57| 51| 67| 82|135|410|970|1210|990|740|700|910|1460|1110|940|870|740|640|600|500|340|200|
| Fri | 95| 55| 60| 54| 70| 85|140|420|980|1220|1000|750|710|920|1470|1120|950|880|750|650|610|510|350|210|
| Sat | 70| 35| 42| 38| 50| 65|100|290|720|890|820|750|720|780|950|880|780|720|680|620|560|420|280|140|
| Sun | 65| 30| 38| 35| 45| 60| 95|280|710|850|800|740|700|760|920|850|750|670|620|580|520|380|250|120|
---
## 2. ASCII Heatmap Visualization
```
WEBSITE TRAFFIC HEATMAP (Visits/Hour)
Legend: · (0-240) ░ (241-480) ▒ (481-720) ▓ (721-960) █ (961-1470)
Hour: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Mon: · · · · · · ░ ░ ▓ █ ▓ ▒ ▒ ▓ █ ▓ ▓ ▓ ▒ ▒ ▒ ░ ░ ·
Tue: · · · · · · ░ ░ ▓ █ ▓ ▒ ▒ ▓ █ ▓ ▓ ▓ ▒ ▒ ▒ ░ ░ ·
Wed: · · · · · · ░ ░ ▓ █ ▓ ▒ ▒ ▓ █ ▓ ▓ ▓ ▒ ▒ ▒ ░ ░ ·
Thu: · · · · · · ░ ░ ▓ █ ▓ ▒ ▒ ▓ █ ▓ ▓ ▓ ▒ ▒ ▒ ░ ░ ·
Fri: · · · · · · ░ ░ ▓ █ ▓ ▒ ▒ ▓ █ ▓ ▓ ▓ ▒ ▒ ▒ ░ ░ ·
Sat: · · · · · · · ░ ▒ ▓ ▓ ▒ ▒ ▒ ▓ ▓ ▒ ▒ ▒ ▒ ░ ░ · ·
Sun: · · · · · · · ░ ▒ ▓ ▓ ▒ ▒ ▒ ▓ ▓ ▒ ▒ ▒ ▒ ░ ░ · ·
```
---
## 3. Key Insights
• **Dual Peak Pattern (Weekdays)**: Consistent traffic spikes at 9am (~1200 visits) and 2pm (~1450 visits) across Monday-Friday, indicating strong business hour usage during morning and post-lunch periods.
• **Weekend Traffic Drop**: Saturday and Sunday traffic is 25-35% lower during peak hours (890 vs 1200 at 9am), suggesting primarily weekday user engagement for this website.
• **Nocturnal Coldspot**: Hours 1am-5am consistently show minimal traffic (30-70 visits) across all days, representing an optimal maintenance and backup window with negligible user impact.
• **Gradual Decline Post-Peak**: Traffic declines steadily from 2pm onwards through evening (1450→620 by 7pm), with evening hours (8pm-11pm) stabilizing at moderate levels (380-620 visits).
• **Early Morning Ramp-Up**: Traffic begins climbing at 6am (80-140 visits) and accelerates sharply from 7am onwards, reaching first peak by 9am—reflecting commute-time browsing and work-start user sessions.
---
## 4. Python Code
```python
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Define traffic data (7 days × 24 hours)
traffic_data = np.array([
[85, 45, 52, 48, 62, 78, 120, 380, 950, 1200, 980, 720, 680, 890, 1450, 1100, 920, 850, 720, 620, 580, 480, 320, 180], # Mon
[90, 50, 55, 50, 65, 80, 130, 400, 960, 1180, 970, 730, 690, 900, 1420, 1090, 930, 860, 730, 630, 590, 490, 330, 190], # Tue
[88, 48, 53, 49, 63, 79, 125, 390, 955, 1190, 975, 725, 685, 895, 1440, 1095, 925, 855, 725, 625, 585, 485, 325, 185], # Wed
[92, 52, 57, 51, 67, 82, 135, 410, 970, 1210, 990, 740, 700, 910, 1460, 1110, 940, 870, 740, 640, 600, 500, 340, 200], # Thu
[95, 55, 60, 54, 70, 85, 140, 420, 980, 1220, 1000, 750, 710, 920, 1470, 1120, 950, 880, 750, 650, 610, 510, 350, 210], # Fri
[70, 35, 42, 38, 50,
Parsed Data Table
Assumed hourly traffic matrix for the past week, constructed to match the scenario:
- Weekdays peak around 9am and 2pm
- Very low traffic from 1am-5am
- Includes required sample values:
- Mon 9am = 1200
- Mon 2pm = 1450
- Mon 3am = 45
- Sat 11am = 890
- Sun 8pm = 670
| Day | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| Mon | 120 | 70 | 55 | 45 | 50 | 80 | 180 | 420 | 850 | 1200 | 980 | 1020 | 1100 | 1180 | 1450 | 1250 | 980 | 760 | 620 | 540 | 460 | 340 | 240 | 160 |
| Tue | 130 | 75 | 60 | 50 | 55 | 85 | 190 | 440 | 880 | 1260 | 1010 | 1050 | 1130 | 1210 | 1490 | 1280 | 1000 | 780 | 640 | 560 | 470 | 350 | 250 | 170 |
| Wed | 125 | 72 | 58 | 48 | 52 | 82 | 185 | 430 | 870 | 1240 | 995 | 1035 | 1115 | 1195 | 1475 | 1270 | 995 | 775 | 635 | 555 | 465 | 345 | 245 | 165 |
| Thu | 128 | 74 | 59 | 49 | 53 | 83 | 188 | 435 | 875 | 1250 | 1005 | 1045 | 1125 | 1205 | 1485 | 1275 | 998 | 778 | 638 | 558 | 468 | 348 | 248 | 168 |
| Fri | 140 | 80 | 65 | 55 | 60 | 90 | 210 | 470 | 920 | 1320 | 1080 | 1120 | 1180 | 1260 | 1520 | 1340 | 1080 | 860 | 740 | 690 | 620 | 500 | 360 | 220 |
| Sat | 160 | 95 | 80 | 65 | 70 | 95 | 150 | 260 | 420 | 620 | 780 | 890 | 860 | 840 | 820 | 760 | 690 | 610 | 560 | 540 | 500 | 430 | 320 | 220 |
| Sun | 150 | 90 | 75 | 60 | 65 | 90 | 140 | 240 | 390 | 560 | 690 | 760 | 740 | 720 | 700 | 660 | 620 | 600 | 610 | 640 | 670 | 520 | 360 | 240 |
ASCII Heatmap with legend
Quintile-based 5-level scale:
- · = Q1 (lowest)
- ░ = Q2
- ▒ = Q3
- ▓ = Q4
- █ = Q5 (highest)
Approximate quintile cutoffs from the dataset:
- · : 45-139
- ░ : 140-349
- ▒ : 350-669
- ▓ : 670-1019
- █ : 1020-1520
Hours → 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Mon · · · · · · ░ ▒ ▓ █ ▓ █ █ █ █ █ ▓ ▓ ▒ ▒ ▒ ░ ░ ░
Tue · · · · · · ░ ▒ ▓ █ ▓ █ █ █ █ █ ▓ ▓ ▒ ▒ ▒ ░ ░ ░
Wed · · · · · · ░ ▒ ▓ █ ▓ █ █ █ █ █ ▓ ▓ ▒ ▒ ▒ ░ ░ ░
Thu · · · · · · ░ ▒ ▓ █ ▓ █ █ █ █ █ ▓ ▓ ▒ ▒ ▒ ░ ░ ░
Fri ░ · · · · · ░ ▒ ▓ █ █ █ █ █ █ █ █ ▓ ▓ ▓ ▒ ▒ ▒ ░
Sat ░ · · · · · ░ ░ ▒ ▒ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▒ ▒ ▒ ▒ ▒ ░ ░
Sun ░ · · · · · ░ ░ ▒ ▒ ▓ ▓ ▓ ▓ ▓ ▒ ▒ ▒ ▒ ▒ ▓ ▒ ▒ ░
Legend:
· lowest traffic ░ low ▒ moderate ▓ high █ peak
Key Insights
- Weekday hotspots are concentrated at 9am and especially 2pm, with Friday 2pm
the weekly maximum at 1520.
- The coldest period is consistently 1am-5am across all days, with the weekly low
at Monday 3am = 45.
- Weekdays show a strong business-hours pattern: traffic rises sharply after 7am,
stays elevated through mid-afternoon, then declines steadily into the evening.
- Saturday has a later, softer midday peak centered around 10am-3pm; Sunday is
flatter overall, with a noticeable evening bump at 8pm = 670.
- Friday remains elevated longer into the evening than other weekdays, suggesting
stronger end-of-week engagement.
```python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Hourly website traffic by day (Monday-Sunday) and hour (0-23)
data = {
"Mon": [120, 70, 55, 45, 50, 80, 180, 420, 850, 1200, 980, 1020, 1100, 1180, 1450, 1250, 980, 760, 620, 540, 460, 340, 240, 160],
"Tue": [130, 75, 60, 50, 55, 85, 190, 440, 880, 1260, 1010, 1050, 1130, 1210, 1490, 1280, 1000, 780, 640, 560, 470, 350, 250, 170],
"Wed": [125, 72, 58, 48, 52, 82, 185, 430, 870, 1240, 995, 1035, 1115, 1195, 1475, 1270, 995, 775, 635, 555, 465, 345, 245, 165],
"Thu": [128, 74, 59, 49, 53, 83, 188, 435, 875, 1250, 1005, 1045, 1125, 1205, 1485, 1275, 998, 778, 638, 558, 468, 348, 248, 168],
"Fri": [140, 80, 65, 55, 60, 90, 210, 470, 920, 1320, 1080, 1120, 1180, 1260, 1520, 1340, 1080, 860, 740, 690, 620, 500, 360, 220],
"Sat": [160, 95, 80, 65, 70, 95, 150, 260, 420, 620, 780, 890, 860, 840, 820, 760, 690, 610, 560, 540, 500, 430, 320, 220],
"Sun": [150, 90, 75, 60, 65, 90, 140, 240, 390, 560, 690, 760, 740, 720, 700, 660, 620, 600, 610, 640, 670, 520, 360,
### Parsed Data Table
Generated 7x24 traffic matrix based on scenario (rows: Mon-Sun, columns: hours 0-23; values in visits):
```
Mon: 45 42 38 45 48 55 260 520 780 1200 1180 1280 1220 1380 1450 1320 1170 1220 1080 920 720 580 380 160
Tue: 40 38 35 42 45 52 240 480 720 1250 1150 1260 1200 1350 1480 1300 1150 1200 1050 900 700 550 350 150
Wed: 42 40 36 43 46 53 250 500 740 1220 1160 1270 1210 1360 1460 1310 1160 1210 1060 910 710 560 360 155
Thu: 41 39 37 44 47 54 255 510 760 1230 1170 1280 1220 1370 1470 1320 1170 1220 1070 920 720 570 370 160
Fri: 43 41 39 46 49 56 270 530 800 1240 1190 1290 1230 1390 1490 1330 1180 1230 1090 930 730 590 390 170
Sat: 32 30 28 30 32 35 130 220 330 500 720 890 820 720 650 580 520 480 520 580 620 550 380 220
Sun: 28 26 25 27 29 32 100 170 270 420 560 620 580 540 500 460 420 460 510 580 650 670 560 320
```
### ASCII Heatmap with legend
Hours:01234567891011121314151617181920212223
Mon:····░░▒▓████████████▓▓▓▒
Tue:·····░▒▓▓███████████▓▓▒▒
Wed:····░░▒▓████████████▓▓▓▒
Thu:····░░▒▓████████████▓▓▓▒
Fri:···░░░▒▓████████████▓▓▓▒
Sat:······░▒▒▓▓██▓▓▓▓▓▓▓▓▓▒
Sun:······░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▒
**Legend** (5-level scale by data quintiles):
· ≤45 (lowest 20%)
░ 46-130
▒ 131-350
▓ 351-750
█ >750 (highest 20%)
### Key Insights
- **Weekday hotspots**: Intense █ traffic (751+ visits) from ~8am-8pm Mon-Fri, peaking at ~1450-1490 around 9am/2pm (e.g., Mon 2pm=1450).
- **Overnight coldspots**: Consistent · (≤45 visits) from 12am-5am all days, confirming very low 1am-5am traffic.
- **Weekend patterns**: Reduced peaks (Sat 11am=890 █; Sun 8pm=670 ▓), with broader ▓ mid-day but no extended █ periods like weekdays.
- **Diurnal rhythm**: Traffic ramps ▒/▓ from 6am, sustains high through afternoons weekdays, drops sharply post-8pm to ░/▒.
- **Overall volume**: Weekdays drive ~80% of high-intensity (█/▓) cells, ideal for scheduling maintenance overnight/weekends.
```python
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Data matrix (7 days x 24 hours)
data = np.array([
[45, 42, 38, 45, 48, 55, 260, 520, 780, 1200, 1180, 1280, 1220, 1380, 1450, 1320, 1170, 1220, 1080, 920, 720, 580, 380, 160], # Mon
[40, 38, 35, 42, 45, 52, 240, 480, 720, 1250, 1150, 1260, 1200, 1350, 1480, 1300, 1150, 1200, 1050, 900, 700, 550, 350, 150], # Tue
[42, 40, 36, 43, 46, 53, 250, 500, 740, 1220, 1160, 1270, 1210, 1360, 1460, 1310, 1160, 1210, 1060, 910, 710, 560, 360, 155], # Wed
[41, 39, 37, 44, 47, 54, 255, 510, 760, 1230, 1170, 1280, 1220, 1370, 1470, 1320, 1170, 1220, 1070, 920, 720, 570, 370, 160], # Thu
[43, 41, 39, 46, 49, 56, 270, 530, 800, 1240, 1190, 1290, 1230, 1390, 1490, 1330, 1180, 1230, 1090, 930, 730, 590, 390, 170], # Fri
[32, 30, 28, 30, 32, 35, 130, 220, 330, 500, 720, 890, 820, 720, 650, 580, 520, 480, 520, 580, 620, 550, 380, 220], # Sat
[28, 26, 25, 27, 29, 32, 100, 170, 270, 420, 560, 620, 580, 540, 500, 460, 420, 460, 510, 580, 650, 670, 560, 320] # Sun
])
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
hours = [str(h) for h in range(24)]
plt.figure(figsize=(12, 4))
sns.heatmap(data, cmap='YlOrRd', xticklabels=hours, yticklabels=days, cbar_kws={'label': 'Traffic (visits)'}, annot=False)
plt.title('Weekly Website Traffic Heatmap (Past Week)')
plt.xlabel('Hour of Day (0-23)')
plt.ylabel('Day of Week')
plt.tight_layout()
plt.show()
```
What makes these work
-
01Specify the output format explicitly
Always state whether you want Python, R, JavaScript, SVG, or HTML output. If you leave it open, most models default to Python, which may not fit your stack. Saying 'Generate a Chart.js heatmap for a React component' versus 'generate a heatmap' produces dramatically different, more usable output.
-
02Define your color scale with intent
Tell the model what the colors should communicate, not just aesthetic preference. 'Red for values below 50%, green for above 80%, yellow in between' gives the model enough information to select the right scale type (diverging, sequential, or threshold-based). Vague requests like 'nice colors' produce generic output that often misleads readers.
-
03Paste or describe data inline in the prompt
AI models cannot access external files. Paste your matrix directly into the prompt or describe the values clearly. For large datasets, provide a representative sample and ask the model to generate code that reads from a CSV, then specify your actual column and row names so the axis labels are correct from the start.
-
04Ask for annotations and axis labels by default
Raw heatmaps without cell values or clear axis labels are almost never useful in practice. Include 'annotate each cell with its value' and 'label both axes' as standard instructions in every heatmap prompt. This saves an iteration cycle and produces presentation-ready output on the first pass.
More example scenarios
I have open rates (%) for email campaigns sent across 5 days (Mon-Fri) and 4 time slots (8am, 12pm, 3pm, 6pm). The values are: Mon 8am 18, Mon 12pm 24, Mon 3pm 21, Mon 6pm 15, Tue 8am 20, Tue 12pm 31, Tue 3pm 27, Tue 6pm 17, Wed 8am 19, Wed 12pm 28, Wed 3pm 25, Wed 6pm 16, Thu 8am 22, Thu 12pm 33, Thu 3pm 29, Thu 6pm 18, Fri 8am 14, Fri 12pm 22, Fri 3pm 19, Fri 6pm 12. Generate Python seaborn code for a heatmap with a blue-to-red color scale and annotated cell values.
The AI produces a complete Python script using seaborn.heatmap() with a 'coolwarm' palette, annot=True to display values in each cell, days as rows, time slots as columns, a labeled colorbar showing open rate %, and a title. The code runs without modification in any standard Python environment with pandas and seaborn installed.
I have a 4-class confusion matrix for a text classification model. Classes are: Sports, Politics, Tech, Entertainment. Matrix values (actual vs predicted): Sports [210, 8, 4, 6], Politics [12, 198, 15, 3], Tech [5, 10, 220, 7], Entertainment [9, 4, 6, 215]. Create a Python matplotlib heatmap with percentage annotations showing what proportion of each actual class was predicted correctly or incorrectly.
The AI returns a matplotlib figure script that normalizes each row by actual class totals, displays percentages formatted to one decimal place inside each cell, uses a green sequential colormap to emphasize high-accuracy cells, labels both axes with class names, and adds a title indicating model name and accuracy. Diagonal cells are visually dominant, making misclassification patterns immediately legible.
Generate an R ggplot2 heatmap showing attendance rates across 6 departments (Sales, Engineering, Support, Marketing, Finance, Operations) for each month of 2024. Use these attendance percentages: [provide 6x12 matrix]. Color scale should go from red at 70% to green at 100%. Add department labels on the y-axis and month abbreviations on the x-axis.
The AI produces a ggplot2 script using geom_tile() with a scale_fill_gradient2() from red to green centered at 85%, coord_fixed() for square cells, theme_minimal() for clean presentation, and geom_text() to annotate each cell with its percentage value. The script includes the data as a tidy data frame built inline so it runs immediately without an external file.
I need a heatmap showing revenue index (1-10 scale, 10 being highest) for 5 product categories (Electronics, Apparel, Home, Sports, Beauty) across 6 US regions (Northeast, Southeast, Midwest, Southwest, West, Northwest). I'll describe the values verbally: Electronics is highest in the West and Northeast, lowest in Southeast. Apparel is consistent at 5-6 everywhere except Southeast at 8. Generate an HTML and CSS grid-based heatmap I can paste into an internal wiki.
The AI produces a self-contained HTML snippet using a CSS grid layout with inline background colors calculated from the described value ranges, a legend div showing the 1-10 color gradient, cell text displaying both the category-region label and numeric index, and a color palette from light yellow to dark orange. No external dependencies are required and it renders correctly in any browser.
I have a 6x6 Pearson correlation matrix for gene expression data. Genes: BRCA1, TP53, EGFR, MYC, VEGF, CDK4. The matrix is symmetric. Key values: BRCA1-TP53=0.82, BRCA1-EGFR=0.31, BRCA1-MYC=0.67, TP53-EGFR=0.45, TP53-MYC=0.71, EGFR-MYC=0.29, EGFR-VEGF=0.88, MYC-CDK4=0.76. Fill remaining values with low correlations around 0.1-0.25. Generate seaborn code with a diverging palette, masked upper triangle, and significance stars for correlations above 0.7.
The AI returns a seaborn clustermap or heatmap script that constructs the full symmetric matrix from the provided values, applies numpy masking to hide the upper triangle, uses the 'RdBu_r' diverging palette centered at zero, overlays asterisk annotations on cells where the absolute correlation exceeds 0.7, and includes a colorbar labeled 'Pearson r'. The output matches standard conventions used in bioinformatics publications.
Common mistakes to avoid
-
Omitting the data or data structure
Prompts like 'generate a heatmap of my sales data' give the model nothing to work with, so it invents plausible-looking but fake numbers. Always include the actual values, a description of the matrix dimensions, and what each row and column represents. Fabricated data in a heatmap is worse than no heatmap.
-
Not specifying the color scale direction
By default, models often use sequential scales where high values are dark. If your context is the opposite (e.g., high error rates should be red, high accuracy green), you must say so explicitly. A reversed or wrong-direction color scale inverts the story your heatmap tells, and reviewers may not catch it immediately.
-
Assuming the code runs without testing it
AI-generated code frequently has minor errors: wrong import aliases, deprecated function arguments, or mismatched variable names. Always run the output in a test environment before using it in a report or sharing it. One broken line in a 30-line seaborn script can prevent any output from rendering.
-
Using AI for real user behavior heatmaps
AI cannot generate heatmaps of where users actually clicked or scrolled on your website. It can only generate code or visualizations from data you already have. If someone on your team asked for a 'heatmap of our homepage,' clarify whether they mean a visualization of existing metrics or actual session-tracking data that requires a dedicated analytics tool.
-
Ignoring outlier handling instructions
If your dataset has extreme outliers, a standard linear color scale will compress all other values into an indistinguishable band. Instruct the model to clip values at a specified percentile or use a logarithmic scale when outliers are present. Failing to address this produces a heatmap where 95% of cells look identical.
Related queries
Frequently asked questions
Can AI generate a heatmap from a CSV file?
Not directly, because AI models cannot read files. The practical approach is to paste a small dataset directly into the prompt, or ask the AI to generate code (Python, R) that reads your CSV by filename and produces the heatmap. You then run that code locally with your actual file. For large CSVs, provide a sample of 10-20 rows so the model understands the structure.
What is the best AI model for generating heatmap code?
GPT-4o and Claude 3.5 Sonnet both perform well for heatmap code generation with complex annotation requirements. GPT-4o tends to produce cleaner Python and handles multi-step customization instructions reliably. Claude often produces better-structured code with inline comments. The comparison table on this page shows side-by-side output from four models on the same prompt so you can judge directly.
Can I use AI to generate a website click heatmap?
No. A click heatmap requires instrumentation on your website that records real user behavior, which tools like Hotjar, Microsoft Clarity, or Crazy Egg provide. AI can generate a visualization if you already have the click coordinate data exported as a table, but it cannot collect that data on its own. If you want to visualize existing click data, describe the data structure in your prompt and ask for a density or scatter heatmap.
How do I get a heatmap image file, not just code?
Ask the AI to include plt.savefig('heatmap.png', dpi=150, bbox_inches='tight') at the end of the Python script, or the equivalent export function in R or JavaScript. You can also use tools like ChatGPT's code interpreter, which executes the code and returns the image directly in the chat. Copy the image from there without needing to run anything locally.
Can AI generate an interactive heatmap I can embed in a dashboard?
Yes. Ask specifically for Plotly (Python or JavaScript), D3.js, or Apache ECharts output. Plotly heatmaps include hover tooltips, zoom, and export by default and can be embedded in Dash, Streamlit, or any HTML page. Specify 'interactive' and your target framework in the prompt, otherwise the model will likely default to static matplotlib output.
How do I make the AI heatmap match my brand colors?
Provide the exact hex codes for your color range in the prompt. For example: 'Use a custom colormap from #F0F4FF (low) to #1A3C8F (high).' In seaborn or matplotlib, the model will use LinearSegmentedColormap.from_list() with your hex values. For multi-stop gradients (low, mid, high), provide all three hex values and tell the model the value at which the midpoint should be anchored.