Skip to main content
v2026.11,986 entries · CC-BY 4.0

Violin Graphs: How to Read, Build and Report Them

What a violin graph shows, how to read it against a box plot, a worked example with the arithmetic, and what to report in methods.

Written and maintained by CASRAI Editorial Board

Published

On this page

A violin graph, usually called a violin plot, shows the full distribution of a continuous variable by drawing a smoothed density curve and mirroring it on both sides of a central axis, so the width of the shape at any height shows how many observations sit near that value. It combines the summary information of a box plot with the shape information of a density plot, which makes it useful for comparing groups whose distributions are skewed or have more than one peak.

What is a violin graph (violin plot)?

The ggplot2 reference describes a violin plot as “a compact display of a continuous distribution”: a mirrored density curve drawn for each group. Hintze and Nelson (1998) introduced the form in The American Statistician as a synergy of the box plot and the density trace, with the density estimate drawn symmetrically on each side. The mirroring carries no extra information. Its purpose is to give the curve a visible body, so that group shapes can be compared side by side the way box plots are.

Violin graphs, violin plots and “violin charts” are the same display. Some software labels the curve a violin and the optional marks inside it (a mini box plot, quartile lines, points or sticks) the “inner” display. The coding detail for each package lives in our guides on violin plots in R and seaborn violin plots; this page covers the concept, the reading rules and the reporting.

How to read a violin plot

Read the vertical axis as the measured value and the horizontal width as density: the wider the violin at a given height, the more observations lie near that value. A violin with two wide regions separated by a narrow waist suggests two clusters, which a box plot would hide. A violin that is wide near the bottom and tapers upward suggests right skew.

What you see What it suggests Check before concluding
Wide bulge at one height Many observations near that value Group sizes and the bandwidth used
Two bulges with a narrow waist Possible two clusters (bimodality) Whether a smaller bandwidth creates the dip; plot the raw points
Long thin tail A few extreme or skewed values Whether the tail is real data or a smoothing extension past the data
Inner box or quartile lines Median and quartiles of the raw data, not of the smoothed curve Which inner marks the software draws by default
Different widths between groups Depends on the width-scaling option Whether widths are equal area, proportional to count, or equal maximum width

Violin plot vs box plot

A box plot reduces a group to five numbers: minimum, first quartile, median, third quartile and maximum, plus outlier flags. A violin plot adds the density, so a multimodal group and a unimodal group with identical quartiles look different. The cost is that the density is an estimate: it depends on a smoothing parameter and on assumptions in the software, whereas the box plot statistics are computed directly from the data. Many authors therefore draw the inner box or quartile marks inside the violin. For a software walk-through of the box plot side, see seaborn box plots.

How a violin graph is built: the density and its parameters

All three mainstream tools described here use a kernel density estimate with a Gaussian kernel. The estimate places a small bell-shaped curve on each observation and sums them; the bandwidth sets how wide each bell is. A large bandwidth gives a smooth curve that can hide structure, and a small one gives a wiggly curve that can invent it. The mirrored curve is then drawn at each group position.

Three quantities need reporting because they change the picture: the bandwidth rule, how far the curve extends past the data, and how widths are scaled across groups. The data table below compares the defaults documented by ggplot2, seaborn and matplotlib. In ggplot2, scale = “area” gives all violins the same area, “count” scales area by sample size, and “width” gives all violins the same maximum width; seaborn offers the same three choices through density_norm (area by default, with common_norm set to False).

Worked example with the arithmetic shown

Take eleven illustrative reaction times in milliseconds, made up for this example: 12, 14, 15, 15, 16, 18, 19, 21, 22, 25, 38.

  • Sum = 215, so the mean is 215 / 11 = 19.55.
  • Sorted, the sixth value is the median: 18.
  • With the inclusive quartile method (position 1 + 0.25 × 10 = 3.5 and 1 + 0.75 × 10 = 8.5), Q1 = (15 + 15) / 2 = 15 and Q3 = (21 + 22) / 2 = 21.5. Other quartile methods give slightly different values, which is another detail worth stating.
  • The sample standard deviation is 7.23 (computed with n − 1 in the denominator).
  • The five-number summary is 12, 15, 18, 21.5, 38, and the value 38 sits far above the rest.

Now the density. With the Scott rule used by seaborn and matplotlib, the bandwidth factor is n^(−1/5) = 11^(−0.2) = 0.619, and the bandwidth is that factor times the standard deviation: 0.619 × 7.23 = 4.48. In seaborn the default cut = 2 extends the curve two bandwidths past the extreme data points: 12 − 2 × 4.48 = 3.05 and 38 + 2 × 4.48 = 46.95. So the drawn violin spans roughly 3 to 47 although no observation is below 12 or above 38. Setting cut = 0 keeps the violin inside 12 to 38, and in ggplot2 trim = TRUE (the default) trims the tails to the range of the data. The same eleven numbers therefore produce visibly different violins in different software or settings, which is why the settings belong in the methods text.

Assumptions and common mistakes

  • Treating the smoothed tail as data. A tail that extends beyond the minimum or maximum, as in the example above, is an artefact of smoothing when cut is above 0 and trim is off.
  • Using violins with very small groups. A density estimated from a handful of points is mostly the bandwidth. Weissgerber and colleagues (2015, PLOS Biology) note that for small samples, univariate scatterplots that show every observation are the better choice, and that box plots and histograms are hard to interpret with small n. They do not discuss violin plots specifically, so extending their advice to violins is our editorial reading: when n is small, overlay the raw points, as in a strip plot, or use a raincloud plot that pairs a half violin with the points.
  • Comparing widths across groups without checking the scaling. Equal-area violins hide differences in sample size; count scaling shows them.
  • Reading the inner mark as the smoothed density. The inner box or quartile lines are computed from the data, while the outline is the estimate.
  • Using a violin when a simpler display answers the question. For choosing among displays, the overview of types of graphs in statistics helps.

When to use a violin graph

Use one when you have a continuous outcome measured in several groups, enough observations per group to estimate a density, and a reason to show shape: skew, clusters or differing spread. Do not use one to hide a small sample, to present a single group (a histogram or density plot is more direct), or when the readers’ field expects box plots and the shape adds nothing.

How to report a violin plot

A figure legend should let a reader reproduce the plot. State what the outline is, what the inner marks are, and which options were used. A template, with every bracket filled from your own settings: “Violin plots show kernel density estimates (Gaussian kernel, bandwidth [rule and value]) of [variable] by [group]; the curves are [trimmed to the data range / extended [x] bandwidths past the extremes]; widths are scaled by [area / count / width]. The inner box shows the median and quartiles of the raw data, and points show individual observations (n = [group sizes]).” Name the software and its version, since the defaults in the table below are version-specific.

For the citation of the method, Hintze and Nelson (1998) is cited as: Hintze, J. L., and Nelson, R. D. (1998). Violin plots: A box plot-density trace synergism. The American Statistician, 52(2), 181–184. https://doi.org/10.1080/00031305.1998.10480559. Check the format against the style manual your journal requires.

How to make a violin graph in R or Python

R with ggplot2 (the default trim = TRUE and scale = “area” are written out so the settings are visible):

library(ggplot2)
ggplot(df, aes(x = group, y = value)) +
  geom_violin(trim = TRUE, scale = "area") +
  geom_jitter(width = 0.1, height = 0, alpha = 0.5)

Python with seaborn (cut = 0 keeps each violin within the data range; inner = “point” shows the observations):

import seaborn as sns
sns.violinplot(data=df, x="group", y="value",
               bw_method="scott", cut=0, inner="point")

Python with matplotlib (draws the data range, with lines at the median):

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.violinplot(data, showmedians=True, bw_method="scott")

Frequently asked questions

What does a violin plot show?

It shows the distribution of a continuous variable for one or more groups: a mirrored kernel density curve whose width at each value reflects how many observations are near it, often with a box or quartile marks inside.

Is a violin graph better than a box plot?

It shows more, because it reveals shape such as skew or two peaks, but it depends on a smoothing choice and is unreliable for very small groups. A box plot is computed directly from the data and is easier to defend when n is small.

Why does my violin extend beyond my data?

Because the density estimate is smoothed. In seaborn the default cut = 2 extends it two bandwidths past the extreme points; in ggplot2 trim = TRUE trims it to the data range by default.

What should I report with a violin plot?

The software and version, the bandwidth rule, whether tails are trimmed or extended, how widths are scaled, what the inner marks show, and the group sizes.

How many observations do I need?

None of the sources read here gives a minimum. Weissgerber and colleagues (2015) advise showing all points for small samples, so overlay the raw data whenever n is small.

Sources

  • ggplot2 reference, geom_violin: https://ggplot2.tidyverse.org/reference/geom_violin.html (read 2026-11-15).
  • seaborn 0.13.2 documentation, seaborn.violinplot: https://seaborn.pydata.org/generated/seaborn.violinplot.html (read 2026-11-15).
  • Matplotlib documentation, Axes.violinplot: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.violinplot.html (read 2026-11-15).
  • Hintze, J. L., and Nelson, R. D. (1998). Violin plots: A box plot-density trace synergism. The American Statistician, 52(2), 181–184. https://doi.org/10.1080/00031305.1998.10480559 (bibliographic record read 2026-11-15).
  • Weissgerber, T. L., et al. (2015). Beyond bar and line graphs: time for a new data presentation paradigm. PLOS Biology. https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.1002128 (read 2026-11-15).

Data: Violin plot defaults documented by ggplot2, seaborn and matplotlib

Default settings that change how a violin plot looks, taken from the current reference pages of three plotting libraries: bandwidth rule, how far the curve extends past the data, and which marks are drawn inside.

Period covered: 2026.

Violin plot defaults documented by ggplot2, seaborn and matplotlib
SoftwareBandwidth defaultExtent of the curveInner or extra marks by default
ggplot2 geom_violinGaussian kernel, bw nrd0, adjust 1trim = TRUE: tails trimmed to the range of the dataQuantiles computed (25/50/75) but lines hidden by default
seaborn 0.13.2 violinplotbw_method scott (scale factor times SD within group)cut = 2: extends 2 bandwidths past the extreme points; 0 keeps the data rangeinner = box (also quart, point, stick, None)
matplotlib Axes.violinplotGaussian KDE, bw_method scottFilled area extends to the entire data range (min to max)Extrema lines on (showextrema True); median and mean lines off

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Violin Graphs: How to Read, Build and Report Them

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →