# Galton board

> Use a Galton board to build a histogram one item at a time: each ball bounces down the pegs into its bin, so the shape of the distribution grows in front of the reader.

- Data type: Many values of one measure (`spread`)
- Pro · not released yet: its code is not available; try it on its page, or use a free chart of the same data type (`spread`)
- Example: **In half the world's countries, a newborn can expect to live past 75** (Life expectancy at birth, 2023; 236 countries and territories in two-year bins)
- How to read it: Each ball is one country, landing in the bin for its life expectancy; the dashed line is the median.
- Phone: Not recommended for mobile (On a phone labels are hard to read or overlap (checked by eye)) · Video formats: 16:9 (best 9:16)

## Use it when
- showing how one measure is spread across 50 to 500 items
- explaining what a distribution is to a general audience
- each item is worth naming on hover

## Avoid it when
- you need the exact shape of a smooth distribution (use a density or histogram)
- more than about 500 items
- readers might take the bouncing for real chance: the balls are steered to their true bins

## Fields (data.json)
- `year` (year): the year of the estimates
- `countries[].country` (place): country or territory
- `countries[].value` (number, unit "years", format decimal): life expectancy at birth, years

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 ball to read the country
- hover a bin for its range and count
- Drop again replays the board
- Motion: Balls are released in a random order and bounce peg by peg down a path that makes exactly the right number of right turns to reach their bin, then drop onto the pile and bounce two or three times before they settle.
- Sound: A soft plink as balls land, pitched by bin, at most a few a second once the first rush is over; a chime when the last ball lands. Quiet while it starts; mute it from its card. (sound is off until the viewer turns it on)
- Physics settings: gravity, restitution, size, seed (the Studio's Physics section, a look's `physics`, or `render --physics key=value`; docs/look-format.md)

## Example spec
```json
{
  "chart": "galton-board",
  "title": "In half the world's countries, a newborn can expect to live past 75",
  "subtitle": "Life expectancy at birth, 2023; 236 countries and territories in two-year bins",
  "data": "/charts/galton-board.data.json"
}
```

## Source
Life expectancy at birth, Our World in Data (UN World Population Prospects 2024) (CC BY 4.0), retrieved 2026-12-01: https://ourworldindata.org/grapher/life-expectancy

Note: The bounces are drawn, not random: each ball's left and right turns are shuffled but always add up to its country's real bin.

Inspired by: [Galton board](https://en.wikipedia.org/wiki/Galton_board), Francis Galton (1889) (linked, not copied).

Live: /charts/galton-board · Manifest: /charts/galton-board.json · Tags: Galton board, bean machine, histogram, distribution, life expectancy, health
