Skip to content

Heatmap

A heatmap is a grid of colored cells. Use it for two categorical axes (e.g. day-of-week × hour-of-day), or for two binned numeric axes (use Plot.rect with binX/binY instead — see Histogram for the binning idea).

```plot view=signups_by_day_hour
Plot.cell(data, { x: "hour", y: "day", fill: "count", inset: 0.5 })
```
```plot view=daily_signups
Plot.cell(data, { x: "week", y: "weekday", fill: "count" })
```
OptionMeaning
x, ycolumn names (typically categorical / ordinal)
fillcolumn name → cell color value
insetgap between cells in px
rcolumn name → also vary cell radius (rare)
color scale (top-level){ scheme: "blues" / "viridis" / "rdbu" / ... }; pair with legend: true
tiptrue for hover tooltips

For binned numeric heatmaps (e.g. binned-x × binned-y), use Plot.rect(data, Plot.bin({ fill: "count" }, { x, y })).

See Observable Plot — cell for the full reference.