When Box Plots Hide Bimodality — Add Density to See Shape
When Box Plots Hide Bimodality , Add Density to See Shape Figure 77.1 , When Box Plots Hide Bimodality
A violin plot combines a box plot with a kernel density estimate (KDE). Each "violin" is a vertical (or horizontal) shap
A violin plot combines a box plot with a kernel density estimate (KDE). Each "violin" is a vertical (or horizontal) shape whose width at any point along the value axis encodes the estimated probability density of observations at that value. The shape is symmetric , the KDE is mirrored around a central spine , so the silhouette reads like a violin or a leaf.
Bimodality is the strongest case. Two distributions — one with a single peak around the median, one with two peaks far f
Bimodality is the strongest case. Two distributions , one with a single peak around the median, one with two peaks far from the median , can produce identical box plots. The five-number summary is identical. The reader sees no difference. The violin plot pulls them apart immediately: the unimodal distribution is a single bulge; the bimodal distribution is a figure-eight or a peanut shape. This is information that genuinely matters: a bimodal salary distribution within a single job title means there is structure (junior vs.
Read the silhouette shape. The width at any height encodes density at that value: where the violin is widest, observatio
Read the silhouette shape. The width at any height encodes density at that value: where the violin is widest, observations cluster; where it pinches, observations are scarce. The full vertical extent shows the data range. The overlaid box plot, drawn down the spine, gives Q1, median, Q3, and outlier points exactly as a standalone box plot would. Compare violins by reading their shapes side by side. Two violins of equal vertical extent but different widths represent distributions with the same range but different concentrations.
The KDE that draws the violin's shape depends on a bandwidth parameter — a smoothing window that determines how rough or
The KDE that draws the violin's shape depends on a bandwidth parameter , a smoothing window that determines how rough or how smooth the resulting curve is. Too narrow a bandwidth and the violin becomes a noisy series of bumps that overfit the sample; too wide a bandwidth and genuine multimodality smooths into a single bulge. The chart looks definitive but is parameter-dependent in a way the box plot is not. Sensible defaults exist.
A box plot alone — the most common alternative — hides multimodality, hides shoulders, and erases sharp cliffs in the ta
A box plot alone , the most common alternative , hides multimodality, hides shoulders, and erases sharp cliffs in the tail. For sample sizes large enough to support a violin (n ≳ 50), the box plot's compactness comes at the cost of information the reader needs to know.
FRAMEWORK FT Visual Vocabulary: Distribution — "Show the range of values in a dataset and how they are distributed." Abe
FRAMEWORK FT Visual Vocabulary: Distribution , "Show the range of values in a dataset and how they are distributed." Abela quadrant: Distribution (single variable, multiple groups, comparison of shape). Tufte principle: the violin's shape encodes density, the box plot's overlay encodes quartiles , every pixel does work, but the chart relies on KDE bandwidth as a parameter the reader cannot see in the chart itself. The one design decision worth knowing: bandwidth choice.
Paste this into Claude Code to generate a working version of this chart, plus its data file. The result will not be a perfect replica , the goal is that the reader can run the prompt, get a chart of this type, and read its source. Generate a complete, self-contained violin plot in D3 v7. Two files:
The ideas in this chapter didn't appear from nowhere. George E. P. Box built much of modern applied statistics , including the Box-Jenkins time-series methods and the Box-Cox transformation , and famously said "all models are wrong, but some are useful." His framework taught generations how to handle distributions with shapes a box plot couldn't capture, which is exactly what the violin plot solves. George E. P. Box, circa 1980. AI-generated portrait based on a public domain photograph (Wikimedia Commons).
George E. P. Box, circa 1980. AI-generated portrait based on a public domain photograph (Wikimedia Commons).
The ideas in this chapter didn't appear from nowhere. George E. P. Box built much of modern applied statistics , including the Box-Jenkins time-series methods and the Box-Cox transformation , and famously said "all models are wrong, but some are useful." His framework taught generations how to handle distributions with shapes a box plot couldn't capture, which is exactly what the violin plot solves. George E. P. Box, circa 1980. AI-generated portrait based on a public domain photograph (Wikimedia Commons).
Brutalist D3 × Claude · Ch.77 · Violin Plot
That is the framework. Brutalist D3 times Claude, chapter 77: Violin Plot. The patterns are now in place. Apply them.