# Correlation heatmap

> Use a correlation heatmap to scan how every pair in a set of measures moves together, then open the pairs that matter.

- Data type: Several measures per item (`relationships`)
- Free (MIT): install with `npx chartreuse add correlation-heatmap`, or registry item `/r/correlation-heatmap.json`
- Example: **Health, wealth and the internet move together; forest cover moves with none of them** (Spearman rank correlation between eight development measures across 174 countries, 2022)
- How to read it: Each square is one pair of measures: blue squares rise together, warm squares move in opposite directions, and paler means weaker.
- Phone: Not recommended for mobile (On a phone labels are hard to read or overlap (checked by eye)) · Video formats: 16:9 (best 16:9)

## Use it when
- you have 4 to 15 numeric measures for the same items
- you want to find which pairs are linked before you chart them
- an overview for analysts, followed by a closer look

## Avoid it when
- you need to show the shape of one relationship (use a scatter)
- the measures are on very few items (r is unstable below about 20)
- readers may read correlation as cause
- more than 15 measures (only the first 15 are drawn)

## Fields (data.json)
- `country` (category): the item, one row each; every other number column is a measure
- `lifeExp` (number, unit "years", format decimal): life expectancy at birth, years
- `infantMort` (number, unit "per 1,000 births", format decimal): infant deaths per 1,000 live births
- `fertility` (number, unit "births per woman", format decimal): births per woman
- `gdp` (number, unit "USD", format currency): GDP per person, PPP, constant 2021 international $
- `internet` (number, unit "%", format percent): share of people using the internet, %
- `electricity` (number, unit "%", format percent): share of people with electricity, %
- `urban` (number, unit "%", format percent): share of people living in urban areas, %
- `forest` (number, unit "%", format percent): forest area as a share of land, %

Units are the example's: with your own data, set each number field's `unit` and `format` (percent, count, decimal, currency, compact) in the meta you pass to mount, or `chartreuse render --unit field=text --format field=count`. Scales and labels follow your data.

## Interactions, motion, sound
- hover or tap a square to read r and open that pair's scatter
- Motion: Squares pop in from the corner outward along the diagonals.
- Sound: A pop on hover, higher for stronger links. Quiet while it draws and between steps; mute it from its card. (sound is off until the viewer turns it on)

## Example spec
```json
{
  "chart": "correlation-heatmap",
  "title": "Health, wealth and the internet move together; forest cover moves with none of them",
  "subtitle": "Spearman rank correlation between eight development measures across 174 countries, 2022",
  "data": "/charts/correlation-heatmap.data.json"
}
```

## Source
World Development Indicators (SP.DYN.LE00.IN, SP.DYN.IMRT.IN, SP.DYN.TFRT.IN, NY.GDP.PCAP.PP.KD, IT.NET.USER.ZS, EG.ELC.ACCS.ZS, SP.URB.TOTL.IN.ZS, AG.LND.FRST.ZS), World Bank (CC BY 4.0), retrieved 2026-12-01: https://data.worldbank.org/indicator

Note: The 174 countries with all eight measures for 2022; the Central African Republic is left out because its 2022 values are a lone outlier in this release. Spearman's r uses ranks, so it catches curved but steady relationships.

Live: /charts/correlation-heatmap · Manifest: /charts/correlation-heatmap.json · Tags: correlation matrix, heatmap, many measures, spearman, development, world bank
