# Violin

> Use a violin to compare the full shape of several distributions: each is a mirrored density, wide where values crowd.

- Data type: Many values of one measure (`spread`)
- Free (MIT): install with `npx chartreuse add violin`, or registry item `/r/violin.json`
- Example: **Physics Nobels go to the youngest winners; economics and literature wait until 67** (Age of every Nobel laureate in the year of the award, by prize, 1901 to 2026)
- How to read it: Each violin is wide at the ages where many laureates won; the white dot is the median and the dark bar the middle half.
- Phone: Adapts to mobile (Draws its own phone layout below 520px) · Video formats: 16:9, 9:16 (best 9:16)

## Use it when
- comparing the shape of 2 to 8 groups with dozens of values or more
- groups may have two peaks or long tails a box plot would hide
- the audience can read a smoothed shape

## Avoid it when
- groups with fewer than about 20 values (use a strip plot)
- readers need exact quartiles (use a box plot)
- one group only (use a histogram or density)
- more than 8 groups (the smallest fold into Other)

## Fields (data.json)
- `name` (text): the laureate
- `category` (category): the group (here the prize): any labels, one violin each; 2 to 8 groups, the smallest fold into Other past 8
- `year` (year): the award year
- `age` (number, unit "years", format count): award year minus birth year

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 violin for its median, middle half, youngest and oldest
- hover the end dots to meet the youngest and oldest laureates
- Motion: Each violin swells open from a thin line, youngest prize first.
- Sound: A soft pop on hover. 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": "violin",
  "title": "Physics Nobels go to the youngest winners; economics and literature wait until 67",
  "subtitle": "Age of every Nobel laureate in the year of the award, by prize, 1901 to 2026",
  "data": "/charts/violin.data.json"
}
```

## Source
Nobel Prize API v2.1: laureates, Nobel Prize Outreach (CC0 1.0), retrieved 2026-12-01: https://api.nobelprize.org/2.1/laureates

Note: Age is the award year minus the birth year, so it can be one year off. Organisations and laureates without a birth date are left out; two-time winners count twice.

Live: /charts/violin · Manifest: /charts/violin.json · Tags: distribution, density, groups, Nobel, age, science, history
