Violin Plot With Points: Jitter, Swarm and Inner Points

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.

Why add points to a violin plot

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:

  • It shows sample size. Readers can see at a glance whether a group has a handful of points or thousands.
  • It shows what the smoothing did. If a bump in the violin rests on two points, the overlay makes that obvious.
  • It shows outliers. A single extreme value becomes a thin, easy-to-miss tail in a violin. As a point, it stands out.

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.

Option 1: Jittered strip plot

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:

  • The horizontal position of each point is random and means nothing. Only the vertical position carries information.
  • Keep the jitter narrower than the violin so points stay inside the shape.
  • With many points, use smaller markers and some transparency (alpha) so dense areas do not turn into a solid blob.
  • Because jitter is random, the plot changes slightly each time you draw it unless you fix the random seed.

Option 2: Swarm (beeswarm) plot

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:

  • Swarm plots do not scale well. With a few hundred points or more per group, the swarm grows wider than its slot. Seaborn warns you when it cannot place all points and some end up overlapping.
  • Point positions are deterministic, so the plot looks the same every time.
  • The width of a swarm grows with the number of points, so it also hints at sample size.

Option 3: Points drawn inside the violin

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.

Comparison table

MethodBest group sizeOverlap handlingRepeatable layoutMain risk
Jittered stripSmall to a few hundredRandom spread plus transparencyOnly with a fixed seedClutter at large n
Swarm / beeswarmSmall to mediumNo overlap until space runs outYesGets too wide at large n
inner=”point”SmallNone; points share one lineYesRepeated values hide each other
inner=”stick”SmallNone; lines can stackYesHard to read with many values
No pointsLargeNot applicableYesHides sample size and outliers

Code examples in seaborn 0.13

The examples below assume a pandas DataFrame df with a categorical group column and a numeric value column.

Violin with a jittered strip plot

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.

Violin with a swarm plot

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.

Points drawn by the violin itself

sns.violinplot(data=df, x="group", y="value", inner="stick")
sns.violinplot(data=df, x="group", y="value", inner="point")

With a hue variable

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.

When n is small

With small groups, the points matter more than the violin. A rough guide:

  • Under about 10 points per group. Consider dropping the violin altogether. A strip or swarm plot with a median line is clearer, and a density curve from so few values says little.
  • About 10 to 30 points. Show the violin and the points together. The points keep readers from trusting the curve too much.
  • Over about 30 points. The violin starts to carry real information. Points are still useful for outliers but optional.
  • Hundreds or thousands of points. Swarms will not fit. Use a strip plot with tiny, transparent markers, or skip the points and report n in the labels.

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.

Design tips

  • Contrast. Use a light or translucent violin with dark points, or the reverse. Two strong colors fighting each other make both layers harder to read.
  • Marker size. Start small (3 to 4 points in seaborn) and increase only if the chart looks empty.
  • Remove redundant marks. If points are shown, the inner box can stay, but quartile lines plus points plus a box is usually too much.
  • Label n. Adding “n = 24” under each group label helps readers even when points are visible.
  • Match the trimming. If the violin extends past the data (the default in seaborn), the gap between the last point and the tip of the violin can look odd. 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.

FAQ

How do I show individual data points on a violin plot?

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.

What is the difference between a strip plot and a swarm plot?

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.

What does inner=”stick” do in seaborn?

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.

Should I always add points to a violin plot?

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.

Why does seaborn warn that points cannot be placed in a swarm plot?

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.

Adrian Lee
Adrian Lee

Adrian Lee is the Data Visualization Specialist and Statistical Analyst at ViolinPlot. Based in Boston, Massachusetts, Adrian utilizes a robust background in statistics and data science to create compelling and insightful visualizations that help interpret complex data.

With extensive experience in data analysis and visualization techniques, Adrian specializes in developing violin plots and other advanced graphical representations to convey statistical information effectively. Adrian’s expertise includes statistical modeling, data interpretation, and the creation of interactive visualizations.

At ViolinPlot, Adrian is responsible for transforming raw data into visual narratives that are both informative and engaging.

By employing state-of-the-art visualization tools and statistical methods, Adrian ensures that the visual representations are accurate, clear, and valuable for decision-making processes.

Adrian’s dedication to enhancing data comprehension through visual tools has established ViolinPlot. As a leading resource for data visualization and statistical analysis.

Articles: 89

Ready to Unlock Deeper Data Insights?

Transform complex datasets into clear, interactive visualizations with Violin Plot. Start exploring data distributions in a way that empowers insight and drives smarter decisions.

LEARN MOre
100% satisfaction guaranteed
McAfee SECURE
ssl-secured
verisign-secured
BEST-PRICE-GUARANTEED-free-trust-badge
guaranteed-safe-checkout-1