Phone:+16179821253
Address: 315 W 3rd St, Boston, Massachusetts, 02127, USA
Email: sloanecarter773@gmail.com
Phone:+16179821253
Address: 315 W 3rd St, Boston, Massachusetts, 02127, USA
Email: sloanecarter773@gmail.com
Split violin plots put two sub-groups back to back in one shape; here is when they help and how to avoid misleading ones.
A split violin plot draws two half-violins back to back in the same slot, one for each level of a second variable. Instead of placing “before” and “after” as two separate violins, each half shows one of them, so you can compare the two shapes directly across the center line. It works best when the second variable has exactly two levels.
This article explains what a split violin shows, when it is the right choice, how to read one, how to make one, and the mistakes to avoid. If you want to look at each group on its own first, you can create a violin plot online from a pasted list of numbers.
A regular violin plot is symmetric: the same density curve is mirrored on both sides of a center line. That mirroring is purely visual. The left half and the right half carry the same information.
A split violin uses that redundant space. The left half shows the distribution for one sub-group and the right half shows the distribution for another. You end up with one asymmetric shape per category on the x-axis, and the two halves can be compared value by value.
A typical example: the x-axis shows four treatment groups, the y-axis shows a measurement, and the two halves of each violin show male and female participants. Or the halves show “control” and “treated” within each cell type. The second variable is usually called the hue variable, after the parameter name in seaborn.
If you need a refresher on how the density shape itself works, see how to read a violin plot, or our main violin plot guide.
Split violins are a good fit when:
They are a poor fit when:
split=True, but with three or more levels the result is a row of half-violins, not a single back-to-back comparison, and it is harder to read.Read it in this order:
If both halves are mirror images, the two sub-groups have similar distributions. If one half bulges where the other is thin, the sub-groups are concentrated in different ranges. If one half has two bulges and the other has one, one sub-group probably contains a mix of two populations. These shape differences are the main thing a split violin is built to reveal.
In seaborn, pass a hue variable and set split=True:
import seaborn as sns
import matplotlib.pyplot as plt
# df has "group", a two-level "condition" column, and "value"
sns.violinplot(data=df, x="group", y="value", hue="condition",
split=True, inner="quart", gap=0.1)
plt.savefig("split_violin.png", dpi=150)
A few notes on this code:
inner="quart" draws dashed lines at the quartiles on each half. With the default inner="box", seaborn draws a narrow box for each half next to the center line, which also works but is smaller.gap=0.1 (new in 0.13) leaves a small space between the two halves, which can make the boundary clearer.hue_order, for example hue_order=["before", "after"].common_norm=False), seaborn normalizes widths separately within each hue level, so the “before” halves are scaled against each other and the “after” halves against each other. Set common_norm=True to normalize all halves on one shared scale.For a broader walkthrough of seaborn violin plots, see violin plots in Python.
ggplot2’s geom_violin() has not traditionally offered a split option, so people usually use an extension package or a custom geom shared in community answers. Check the documentation for your installed version before adding one. Our violin plot in R guide covers the regular violin; for split violins, look for an extension that adds a split violin geom and check that it is maintained.
If you just need a standard violin chart from a list of numbers, you can use our free violin plot maker in the browser.
Each half is drawn from its own density estimate. With area scaling (the default in seaborn), a half built from 15 points can look as substantial as a half built from 1,500. Readers will assume the halves are equally reliable. Fix this by showing n in the legend or labels, or by using count-based width scaling so the smaller group is visibly thinner. In seaborn that means density_norm="count" together with common_norm=True; without common_norm=True, the counts are only compared within each hue level, not between the two halves.
Each half gets its own bandwidth from its own data. If one sub-group is much more spread out than the other, its curve will be smoothed more. That is usually fine, but it means some shape differences come partly from the smoothing. Our guide to violin plot bandwidth explains how this works.
When the halves differ only by color, readers with color vision deficiency may not tell them apart. Use a palette with a clear lightness difference between the two colors, and keep the legend close to the plot.
With seaborn’s default cut=2, each half extends a little past its own minimum and maximum. If the two sub-groups have different ranges, that extension can look like a real difference in tails. Set cut=0 to trim each half to its data.
A split violin puts two groups side by side, but it does not show whether the same subjects appear in both. If your data are paired (the same people measured before and after), a split violin hides that structure. Consider adding lines connecting each subject, or a separate chart of the differences.
Split violins save space, but a row of twelve split violins is still a lot to read. If the categories have a natural order, sort them. If not, consider showing only the most important ones.
| Aspect | Split violin | Side-by-side (dodged) violins |
|---|---|---|
| Space per category | One slot | Two slots |
| Direct shape comparison | Easy, halves touch | Harder, eyes must jump |
| Works with 3+ hue levels | Poorly | Yes |
| Familiarity | Less familiar | More familiar |
| Shows full symmetric shape | No, half only | Yes |
For general advice on when a violin is the right chart in the first place, see violin plot vs box plot.
It compares two sub-groups within each category by drawing one half-violin for each sub-group back to back. Typical uses are before/after, control/treatment or male/female comparisons.
Call sns.violinplot() with a hue variable and split=True. Adding inner="quart" draws quartile lines on each half.
Since seaborn 0.13, split=True works with more than two hue levels, but a violin only has two sides, so the result is harder to read. Split violins are clearest with exactly two levels.
By default seaborn normalizes each hue level separately, so the halves are not scaled against each other. Use density_norm="count" with common_norm=True to make widths reflect the number of observations, or label each group with its n.
Transform complex datasets into clear, interactive visualizations with Violin Plot. Start exploring data distributions in a way that empowers insight and drives smarter decisions.



