Violin Plot — Definition & Example
A violin plot is a graph of one numerical data set that shows a box plot inside a smooth, mirrored outline. The outline is wider wherever more data values fall, so you can see the shape of the data as well as its center and spread.
A violin plot displays a smoothed estimate of a distribution's density, usually a kernel density estimate. The curve is reflected across a central axis to form a symmetric outline. Inside it, a box plot or quartile markers show the median and the interquartile range. At any value on the measurement axis, the outline's width is proportional to the estimated density there.
Worked Example
Problem: Two schools each survey 11 students about commute times in minutes. School A: 10, 14, 15, 15, 16, 20, 24, 24, 25, 26, 30. School B: 10, 12, 15, 19, 20, 20, 20, 21, 25, 28, 30. Show that the two schools have identical box plots, then explain how their violin plots differ.
Step 1: Find School A's five-number summary. The median is the 6th value. Q1 is the median of the lower five values (10, 14, 15, 15, 16). Q3 is the median of the upper five values (24, 24, 25, 26, 30).
Step 2: Repeat for School B. The lower five values are 10, 12, 15, 19, 20, so Q1 = 15. The upper five values are 20, 21, 25, 28, 30, so Q3 = 25. The 6th value is 20. Every number matches School A, so the two box plots are identical.
Step 3: Count how many values fall within 2 minutes of 15, 20, and 25. These counts show where each violin bulges.
Answer: Both schools have the five-number summary 10, 15, 20, 25, 30, so their box plots look the same. School A's violin has two wide bulges near 15 and 25 minutes and a narrow waist at 20. Its data are bimodal. School B's violin has one wide bulge at 20 minutes. Only the violin plot reveals this difference.
Why It Matters
Box plots can hide clusters, gaps, and bimodal shapes, and violin plots expose them. Data scientists and biologists often place several violins side by side to compare groups, for example gene expression levels across cell types. The comparison works even when the groups have similar medians and quartiles.
Common Mistakes
Mistake: Reading the left and right halves of a violin as two different groups.
Correction: Both halves are the same density curve, mirrored for symmetry. To compare groups, look at separate violins placed side by side. A split violin is the exception, and its legend will say that each half shows a different group.
