Table heatmap
Show a 2D matrix of values — confusion matrices, hour×day activity, regional×product sales. Colour intensity replaces explicit numeric labels for fast pattern recognition.
The demo plots weekly excess-mortality rate (per 1 000) during the 1918 influenza pandemic across five US cities × eight weeks (late Sep – mid-Nov). Cities that imposed early NPIs — school closures, public-gathering bans — cap visibly lower than cities that delayed; Philadelphia's catastrophic week-4 peak followed its decision to allow a 200 000-person Liberty Loan parade on Sep 28. The data anchors Markel et al.'s 2007 JAMA analysis of NPI effectiveness.
Source: 1918 flu pandemic in the United States — Wikipedia
Public surface
use wisp_chart::heatmap::{TableHeatmap, SequentialPalette};
let h = TableHeatmap::new(
vec!["Mon".into(), "Tue".into(), "Wed".into()],
vec!["00h".into(), "06h".into(), "12h".into(), "18h".into()],
vec![
vec![ 5.0, 20.0, 40.0, 18.0],
vec![ 8.0, 25.0, 50.0, 22.0],
vec![10.0, 30.0, 55.0, 24.0],
],
).palette(SequentialPalette::blues());
let g = h.emit_graphics(&theme, Vec2::new(400.0, 240.0));
Palette options
| Palette | Use case |
|---|---|
SequentialPalette::blues() | Default — single-hue magnitude |
SequentialPalette::magma() | Heat / intensity reads |
SequentialPalette::github() | Discrete-level contribution graphs |
SequentialPalette::new(stops) | Custom palette from your colours |