13A.13 Boxplot, violin, and subject-level distributions
boxplot summarizes a distribution by median, quartiles, whiskers extending to 1.5 IQR, and displayed outliers. violin mirrors a smoothed density. Both require y and usually a categorical x; with no x, they show one overall distribution.
The two geoms answer related but distinct questions. A boxplot gives robust landmarks and compact comparison. A violin shows shape, possible skewness, and multimodality, but the shape depends on density estimation and can look authoritative with very small N. Layering them can provide both, provided the box remains visible.

Repeated-record warning
Baseline WT, BMI, ETA, or demographic values are often repeated on every observation record. The frozen figure applies distinct = ["ID"], yielding 30 subjects rather than 270 records. Without this reduction, subjects with more rows receive more weight. Confirm that the first record contains the correct subject value and that the variable is truly time-invariant.
Jittered points can be layered to show the actual sample behind summaries. For privacy or dense data, use nonidentifying marks. Do not delete an outlier just because the boxplot labels it; the 1.5-IQR rule is a display convention, not an error definition.
Compare the plotted median and range with a subject-level summary table. This catches accidental record weighting and confirms that a narrow violin is not merely a consequence of missing values. If groups have very different sizes, report their counts near the figure because equal-width panels can imply equal information.
Common mistakes
- Using repeated observation rows for baseline distributions.
- Treating whisker outliers as data errors.
- Reading a small-sample violin as a stable density.
- Comparing groups without showing their N.
Checklist
- Reduce to the intended subject/occasion grain.
- Report group counts.
- Review raw points or listings for outliers.
- Separate data correction from display rules.
- Avoid density claims with very small groups.
Further reading
See distinct, histogram and density, demographics, and missing denominators.