Skip to content

Violin Plots

A violin plot combines:

  • A KDE distribution shape
  • A box-plot-like summary inside

It’s useful when you want to see the shape of distributions (multi-modal, skew).

diagram Violin = box plot + KDE mermaid
A violin plot mirrors a KDE curve left and right to form a shape, with a mini box plot drawn down the middle.
Violin plot
import seaborn as sns
import matplotlib.pyplot as plt
 
tips = sns.load_dataset("tips")
 
plt.figure(figsize=(7, 4))
sns.violinplot(data=tips, x="day", y="total_bill")
plt.title("Total bill distribution by day")
plt.tight_layout()
plt.show()
Violin with inner quartiles
import seaborn as sns
import matplotlib.pyplot as plt
 
tips = sns.load_dataset("tips")
 
plt.figure(figsize=(7, 4))
sns.violinplot(data=tips, x="day", y="total_bill", inner="quartile")
plt.title("Violin plot with quartiles")
plt.tight_layout()
plt.show()

The width of the violin at any height shows how common values near that height are — wider means more data points cluster there:

sketch Anatomy of a violin plot p5.js
The violin's width at each height mirrors the KDE density; the inner bar is a mini box plot.
  • Use box plots for quick comparisons and outlier focus.
  • Use violin plots when the distribution shape matters.

Continue to Bar Plots in Seaborn to compare an aggregated value (like a mean) across categories, with confidence intervals.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading