This entry is part of the Chart Index, the reference library for the Chart Design Field Guide.

The violin plot answers the box plot's biggest weakness: a box hides the shape of the distribution. Where Tukey's box reduces the data to five numbers, the violin replaces the box with a kernel density estimate — a smooth curve, mirrored around a central axis, that shows the full shape: bimodality, skew, asymmetric tails, sharp modes. The cost is that quartiles become less precise.

The form is most useful when distribution shape matters as much as central tendency. For a single distribution it can be overkill; for comparing many distributions where shape is the story, it is unrivalled.

What it is

A violin plot encodes a distribution as a mirrored kernel density curve. The density is computed once and reflected across a vertical (or horizontal) axis, producing a shape that bulges where observations cluster and narrows where they are sparse. Most implementations embed a slim summary inside the violin — a bar for the interquartile range and a dot at the median — to recover the quartile information the curve alone does not give.

The hero chart above shows four service tiers, thirty requests each. The shapes carry information the medians cannot: the Edge tier is a fat base near 12 ms with a long, thin tail of slow requests; Standard is a single hump; Compute has two distinct bulges — a cached path near 15 ms and a database path near 80 ms — with a pinched waist between; Legacy is a broad spindle that stretches past 120 ms. Randomise the observations and the densities are recomputed from the raw values, so the bimodal tier stays bimodal.

When to use it

Violin plots are the right choice when:

  • You are comparing distributions across groups and shape matters — bimodality, skew, sharp modes.
  • You have enough observations per group for a kernel density estimate to be meaningful (typically ≥100).
  • The reader's question is "what are these distributions actually shaped like?"
  • You need richer information than a box plot without the bin-width fragility of a histogram.
  • The data is continuous — violins on integer data with few values produce misleading curves.

When not to use it

  • Small samples. Below 50 observations per group, the kernel density curve is fiction. Use a strip plot or bee swarm.
  • Unfamiliar audiences. Violins read as decoration to readers who do not know the form. For business audiences, a box plot or strip is safer.
  • Need for precise quartiles. Embedded summaries help, but the violin is fundamentally a shape chart, not a quartile chart.
  • One distribution. A single violin floating in space is rare; a histogram or density plot reads better.

Design principles

Use the violin where the box would lie

The box plot's compression is silent: two distributions with the same quartiles draw the same box. The violin is the form that makes that difference visible.

Two endpoints as box plots: no difference to see
The /search and /checkout endpoints have the same median response time, matching quartiles and the same range. A reader would conclude they behave alike.
The same two endpoints as violins
/search is a single hump. /checkout is pinched in the middle: a fast path near 40 ms and a slow path near 60 ms, and the median falls in the gap between them where almost no request actually lands.

Embed a summary inside the violin

A bare violin loses Tukey's quartile information. Hadley Wickham's ggplot2 convention places a thin box plot down the centre of each violin; the renderer used here draws a slim interquartile bar with a hollow dot at the median. The combined form gives shape and summary; the eye reads either depending on the question.

Choose bandwidth deliberately

Most violin implementations default to Silverman's rule of thumb. For long-tailed distributions, that rule oversmoothes. For multimodal distributions, it can hide modes. Pick a bandwidth by experiment and state it. Bandwidth: 6 ms in the subtitle is honest; a violin with no stated bandwidth is incomplete. The two figures below draw the hero's Compute tier at the extremes.

Bandwidth 2 ms: a comb, not a curve
With a kernel narrower than the gaps between observations, every request becomes its own bump. The two modes are still there, but so is a great deal of texture that is only sampling noise.
Bandwidth 50 ms: the modes melt together
Smooth the same thirty requests with a wide kernel and the pinch disappears — the violin becomes one broad spindle, and the reader is told the tier has a single, wide distribution. It does not.

Do not smooth a handful of points

A kernel density estimate of eight observations looks exactly as confident as one of eight hundred. The violin's smoothness reads as certainty, and with a small sample that certainty is invented.

Eight observations per group, drawn as violins
These curves look authoritative. Every bulge and waist is the product of a handful of points and a bandwidth choice; a different eight requests would draw different shapes.
The same eight observations, shown as they are
Eight dots per region with a median rule. Nothing is smoothed, nothing is implied, and the reader can count exactly how much evidence there is.

Mirror or one-side, deliberately

Standard violins are mirrored. Half-violins — showing only one side — are useful when paired with another visualisation (raw points, box plot) on the unused side. The hybrid is sometimes called a raincloud plot.

Keep widths consistent

If you scale violin width by group size (n), the chart encodes two variables — distribution shape and count — without telling the reader. Either fix the widths and annotate the n separately, or document the area-encodes-count convention explicitly. The default in most tools — every violin scaled to the same maximum width — is the one to keep.

Use a single hue family

Like all multi-distribution displays, violins benefit from quiet, consistent colour. A single accent hue across all violins, or a soft sequential ramp keyed to an ordinal dimension (e.g. tier), lets the shapes do the talking; a categorical rainbow asks the reader to decode colour before they can read the curves.

One hue: the shapes are the encoding
Four tiers in a single blue. Nothing is lost — the tier is already named on the axis — and the reader's attention goes straight to the differences in shape rather than to the palette.

Avoid overlapping violins

Violins do not overlay cleanly. Two semi-transparent violins on top of each other become a third shape that neither distribution would predict. For comparison, place them side by side or use a different form entirely.

Annotate the modes

If a violin shows two clear modes, point them out. Bimodal: cached responses cluster at ~15 ms, database responses at ~80 ms. A one-line annotation explains what the shape implies.

Anatomy

The composition of a violin plot
An anatomical guide

The violin is structurally a mirrored density curve with a slim quartile summary embedded down its centre. The shape carries the distribution; the bar and dot recover the five-number summary the box plot would have given.

  • Box plot — the form the violin extends. More compact, easier to read precisely, hides shape.
  • Density plot — a single distribution's smoothed curve. The violin's basis, without mirroring.
  • Strip / jitter plot — every point shown. Useful for small samples and as the raincloud companion.
  • Bee swarm — strip plot with collision avoidance; another shape-preserving alternative.
  • Histogram — the unsmoothed alternative. Honest about its bins.

Reading list

  • Hintze, J. & Nelson, R. (1998). Violin Plots: A Box Plot–Density Trace Synergism. The form's introduction.
  • Wickham, H. (2010). A Layered Grammar of Graphics. Embedded box plots in ggplot2.
  • Allen, M. et al. (2019). Raincloud Plots: A Multi-Platform Tool for Robust Data Visualisation. The raincloud variant.