Violin plotA box plot with its shape.
The shape of the values, mirrored like a violin's body, with a small box plot inside. Wide where values crowd, thin where they are rare.
- Answers How are the values spread?
- Your data values of one number per group
- Values about 30 or more per group
- Groups 2 to 10
- Excel and Power BI not built in
What is a violin plot?
A violin plot draws, for each group, the shape of its values as a smooth curve mirrored around a line, so it looks like a violin's body. It is wide where many values sit and thin where few do. A small box plot inside marks the middle half and the median. Its strength: it shows two clumps where a box plot shows one ordinary box.
A shop measures how long visitors stay on a product page. On laptops, times spread evenly. On phones, the violin has two bulges: people who leave at once, and people who stay almost a minute.
Why use a violin plot?
Because it keeps the box plot's summary and adds the shape.
- Clumps show. Two peaks in a group are easy to see.
- Summary inside. The small box still gives the median and the middle half.
- Groups side by side. Several violins compare as easily as boxes.
- Fits big data. Thousands of values draw one smooth shape.
How does a violin plot work?
Four steps turn values into a violin.
- Step 1 of 4Every valueEach visit as a dot, one row per device.
- Step 2 of 4A smooth shapeA smooth curve of where the visits bunch up.
- Phone
- Laptop
- Step 3 of 4Mirror itDraw the curve on both sides of the group's line.
- Step 4 of 4Box insideA small box plot in the middle gives the median and the middle half.
What are the parts of a violin plot?
Four parts, and each one has a job.
- Shapewide where values crowd, thin where they are rare
- Boxthe middle half of the values
- Medianthe middle value
- Value axisthe number, shared by every group
How do you read a violin plot?
Three looks, in this order.
- Count the bulgesPhone has two: visits of about 10 seconds and of about 50.
- Compare the mediansThe median lines: Phone 27 seconds, Laptop 43.
- Check the box against the shapePhone's median sits in the thin middle, where almost no visit falls.
What kinds of violin plot are there?
The same two devices, three ways.
- Kind 1Full violinMirrored shape with a box inside.
- Kind 2Half and dotsHalf the shape, a box and the dots: a raincloud plot.
- Kind 3One group litGrey and an accent, to point at one group.
When should you use a violin plot?
When the shape of each group matters, not only its middle.
- groups may have two clumps
- there are about 30 values or more per group
- you compare 2 to 10 groups
- readers know box plots
- there are few values (a strip or beeswarm plot)
- readers are new to charts (a bar chart of medians)
- one group only (a histogram)
Violin plot or box plot?
A violin when there might be clumps, a box plot when there are not.
On the box plot, Phone and Laptop look much alike: a wide box, a median in the middle. The violin shows the truth: phone visitors split into two groups, and the median falls in the gap between them.
How do you make a violin plot?
Not built into Excel or Power BI; one line in Python or R.
In Python, seaborn's violinplot draws one from a value column and a group column. In R, geom_violin in ggplot2 does the same. In Power BI, use a Python or R visual (Python and R visuals in Power BI) or a violin visual from AppSource (custom visuals).
What goes wrong with violin plots?
The most common mistake, and its fix: a smooth shape over too few values.
- about 30 values or more per group
- dots on top for small groups
- or a strip plot
| Mistake | Why it hurts | Fix |
|---|---|---|
| Too few values | The shape is invented | About 30 or more, or show the dots |
| Shape past the real values | Shows impossible values (below zero) | Cut at the real limits |
| No box inside | The median is hard to find | A small box or a median line |
| Different widths meaning different things | Readers compare widths across groups | Say how widths are scaled |
| Readers new to it | They do not know what width means | A one-line note, or a box plot |
Every chart for “How are the values spread?”
- One groupHistogramTouching bars that count how many values fall in each range.
- One groupDensity plotA smooth curve of where values bunch up.
- One groupStrip plotEvery value as a dot along one line.
- One groupBeeswarm plotDots that push apart instead of overlapping, so every value shows.
- Comparing groupsBox plotThe middle half as a box, the median as a line, the rest as whiskers.
- Comparing groupsRidgeline plotDensity curves stacked and overlapping, one per group.
- Comparing groupsRaincloud plotHalf a violin, a box and the dots, in one picture.
- Comparing groupsPopulation pyramidTwo histograms back to back, by age and sex.
- CumulativeCumulative distributionA rising line of the share of values at or below each point.
- CumulativePareto chartBars from biggest to smallest with a running total line.
- Fit checkQ-Q plotDots along a line when the data fits the shape you expect.
Read on, step by step.
Does it fit your data? Try it.
Paste your table into Chart Compass, say what the chart should show, and see the charts that fit, drawn with your own numbers. It runs in your browser, so the data stays with you.