Course contentsShow
← Data Science
Lesson 1223 of 2,14531. Data Visualization PrinciplesFree lesson

Box Plots and Violin Plots

Compare distributions across groups using box plots for quartiles and violin plots for full density information.

Box Plots and Violin Plots

You'll learn: How to compare distributions across groups using box plots for quartiles and violin plots for full density information.

The Core Idea

When you need to compare distributions across different groups, two powerful chart types shine: box plots and violin plots. Both let you see multiple distributions side-by-side, making group differences immediately visible.

Box plots show the distribution through five key numbers: the minimum, first quartile (Q1), median (Q2), third quartile (Q3), and maximum. The "box" spans from Q1 to Q3 (the middle 50% of data), with a line at the median. "Whiskers" extend to show the range, and outliers appear as individual points. Think of a box plot as a distribution summary – compact and focused on spread and central tendency.

Violin plots go further by showing the full probability density of the data. They're like box plots merged with density curves (KDE), displaying the entire shape of the distribution. Wider sections indicate where more data points concentrate; narrow sections show sparse areas. Imagine a violin plot as a distribution portrait – revealing bumps, multiple peaks, and skewness that box plots hide.

When to Use Each

Use box plots when you want clean, quartile-based comparisons across many groups – they're easy to read and highlight outliers clearly.

Use violin plots when the shape of the distribution matters – they reveal bimodal patterns, skewness, and density variations that quartiles alone miss.

Often, violin plots include a small box plot inside them, giving you both the quartile summary and the full density shape.

Key Takeaway: Box plots efficiently summarize distributions using quartiles and outliers; violin plots reveal the complete density shape, making them ideal when distribution details matter for comparing groups.