# Scatter matrix

> Use a scatter matrix to see the shape of every pairwise relationship in a handful of measures at once, and follow one item through all of them.

- Data type: Several measures per item (`relationships`)
- Free (MIT): install with `npx chartreuse add scatter-matrix`, or registry item `/r/scatter-matrix.json`
- Example: **Past $15,000 a head, nearly every country has electricity for everyone** (Five development measures for 174 countries, 2022; each small panel pairs two of them)
- How to read it: Below the diagonal each panel is a scatter of its row against its column; above it is the r for the same pair; the diagonal shows each measure's spread.
- Phone: Adapts to mobile (Draws its own phone layout below 520px) · Video formats: 16:9 (best 9:16)

## Use it when
- 3 to 6 measures and you want every pair's shape, not just one number
- relationships may be curved, clustered or capped
- you want to follow one item across all pairs

## Avoid it when
- more than about 6 measures (only the first 6 are drawn; use a correlation heatmap first)
- readers need one clear message (pick the one scatter that carries it)
- small screens with thousands of items

## Fields (data.json)
- `country` (category): the item, one row each; every other number column is a measure (2 to 6)
- `gdp` (number, unit "USD", format currency): GDP per person, PPP, constant 2021 international $
- `electricity` (number, unit "%", format percent): share of people with electricity, %
- `internet` (number, unit "%", format percent): share of people using the internet, %
- `lifeExp` (number, unit "years", format decimal): life expectancy at birth, years
- `fertility` (number, unit "births per woman", format decimal): births per woman

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 dot to read it and ring the same country in every panel
- Motion: The panels fade in one after another, top left to bottom right.
- Sound: A pop on hover pitched by row. 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": "scatter-matrix",
  "title": "Past $15,000 a head, nearly every country has electricity for everyone",
  "subtitle": "Five development measures for 174 countries, 2022; each small panel pairs two of them",
  "data": "/charts/scatter-matrix.data.json"
}
```

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

Note: 87 of the 95 countries above $15,000 per person have electricity for at least 99.5% of people. r is Pearson's, with GDP on a log scale. The Central African Republic is left out: its 2022 values are a lone outlier in this release.

Live: /charts/scatter-matrix · Manifest: /charts/scatter-matrix.json · Tags: splom, scatter plot matrix, pairs plot, many measures, linked highlighting, development, electricity
