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
How and when to show individual observations on a violin plot, with seaborn examples for strip, swarm and inner points.
To add data points to a violin plot, draw the violin first and then overlay the raw observations as a jittered strip plot or a swarm (beeswarm) plot. Some tools can also draw the points inside the violin directly, as small dots or tick marks. Showing the points is most useful when groups are small, because it lets readers see how much data sits behind each smooth shape.
This article covers the main ways to combine violins and points, when each works best, and how to do it in Python with seaborn 0.13.
A violin is a smoothed estimate of the distribution. It looks equally confident whether it comes from 12 values or 12,000. Adding the raw points fixes that in three ways:
Before you add points, it can help to see the plain violin for your data; a free violin chart maker gives you one in seconds with no code.
If you are still learning to read the shapes themselves, start with how to read a violin plot. For the basics of the chart type, see our violin plot guide.
A strip plot draws one dot per observation along the value axis. On its own, every point in a group would fall on the same vertical line and overlap. Jitter fixes this by adding a small random horizontal offset to each point, so they spread out sideways.
When it works: small to medium groups, from a handful of points up to a few hundred.
Things to know:
A swarm plot also draws one dot per observation, but instead of random offsets it places each point as close to the center line as possible without overlapping any other point. The result traces the shape of the distribution with the points themselves, which looks a lot like a violin made of dots.
When it works: small to medium groups where you want every point visible and no overlap.
Things to know:
Some tools can mark each observation inside the violin instead of drawing a separate layer. In seaborn this is the inner parameter:
inner="point" draws a small dot for each observation along the center line.inner="stick" draws a short horizontal line across the violin for each observation, which looks a bit like a rug plot inside the shape.These options keep the chart compact, but the points are not spread out, so many identical or close values stack on top of each other. They work best for small groups with few repeated values.
| Method | Best group size | Overlap handling | Repeatable layout | Main risk |
|---|---|---|---|---|
| Jittered strip | Small to a few hundred | Random spread plus transparency | Only with a fixed seed | Clutter at large n |
| Swarm / beeswarm | Small to medium | No overlap until space runs out | Yes | Gets too wide at large n |
| inner=”point” | Small | None; points share one line | Yes | Repeated values hide each other |
| inner=”stick” | Small | None; lines can stack | Yes | Hard to read with many values |
| No points | Large | Not applicable | Yes | Hides sample size and outliers |
The examples below assume a pandas DataFrame df with a categorical group column and a numeric value column.
import seaborn as sns
import matplotlib.pyplot as plt
ax = sns.violinplot(data=df, x="group", y="value",
inner=None, color="0.85", cut=0)
sns.stripplot(data=df, x="group", y="value",
jitter=0.15, size=4, color="black", alpha=0.6, ax=ax)
plt.savefig("violin_strip.png", dpi=150)
Setting inner=None removes the default mini box plot so it does not clash with the points. A light gray violin keeps the dots readable. cut=0 stops each violin at the smallest and largest observed values, so the shape does not extend past the points.
ax = sns.violinplot(data=df, x="group", y="value",
inner=None, color="0.85")
sns.swarmplot(data=df, x="group", y="value",
size=3, color="black", ax=ax)
If seaborn prints a warning that some points cannot be placed, reduce the size or switch to a strip plot.
sns.violinplot(data=df, x="group", y="value", inner="stick")
sns.violinplot(data=df, x="group", y="value", inner="point")
If you color violins by a second variable with hue, pass the same hue to the point layer and set dodge=True so the points line up with their violins. Keep the category order the same in both calls; if you set order or hue_order on one, set it on the other.
For more on plotting in Python, see how to make a violin plot in Python. R users can get the same effect with geom_violin() plus geom_jitter() or a beeswarm layer; our violin plot in R article covers the details.
With small groups, the points matter more than the violin. A rough guide:
These thresholds are rules of thumb, not fixed limits. The right cutoff depends on how spread out your data is and what question the chart needs to answer.
Also consider how many groups you have. Even if each group is small, ten violins with points each can get busy. Wider spacing and a single neutral color for the points help.
cut=0 closes it.If you just need a quick chart from a list of numbers, you can build a violin plot online without writing any code.
Overlay a strip plot (with jitter) or a swarm plot on top of the violin. In seaborn, draw sns.violinplot() first, then sns.stripplot() or sns.swarmplot() on the same axes.
A strip plot spreads points with random sideways jitter, so points can still overlap. A swarm plot positions points so they do not overlap, which is clearer for small groups but runs out of room for large ones.
It draws a short line across the violin for each observation, instead of the default mini box plot. inner="point" does the same with dots.
Not always. They are most helpful for small and medium groups, and for showing outliers. With thousands of points per group, they add clutter and the violin alone usually tells the story.
There are too many points to fit side by side in the available width. Make the markers smaller, make the figure wider, or use a strip plot instead.
Transform complex datasets into clear, interactive visualizations with Violin Plot. Start exploring data distributions in a way that empowers insight and drives smarter decisions.



