Learn Statistics & Data Visualization

Master box plots, violin plots, outlier detection, and key statistical concepts — all in one place.

What is a Box Plot?

A box plot (also called a box-and-whisker plot) is a standardized way of displaying the distribution of data based on a five-number summary: minimum, first quartile (Q1), median, third quartile (Q3), and maximum.

Invented by John Tukey in the 1970s, the box plot is built on the five-number summary:

StatisticDescription
Minimum (Min)The smallest data point, excluding outliers
First Quartile (Q1)25th percentile — 25% of data falls below Q1
Median (Q2)50th percentile — the middle value of the sorted data
Third Quartile (Q3)75th percentile — 75% of data falls below Q3
Maximum (Max)The largest data point, excluding outliers
IQRQ3 − Q1 — the spread of the middle 50% of data
WhiskersLines from the box extending to min and max (non-outlier range)
OutliersPoints beyond 1.5 × IQR from Q1 or Q3 (Tukey fences)

How to Read a Box Plot

Step by Step

  1. Locate the median line inside the box — this is the middle value of your dataset.
  2. Look at the box width (IQR) — a wider box means more variability in the middle 50% of data.
  3. Check whisker lengths — asymmetric whiskers indicate skewness.
  4. Identify outliers as dots beyond the whiskers.
  5. Compare boxes when multiple datasets are plotted — look at median shifts and IQR changes.

What the Shape Tells You

  • Symmetric: Median centered in box, whiskers roughly equal length
  • Right-skewed: Median closer to Q1, upper whisker longer
  • Left-skewed: Median closer to Q3, lower whisker longer
  • Wide IQR: High variability in the middle 50%
  • Narrow IQR: Data tightly clustered around the median

Box Plot vs Violin Plot

Key Differences

FeatureBox PlotViolin Plot
DisplaySummary statisticsFull distribution shape
DensityNot shownKDE curve on each side
Multi-modalityCannot show (only hints)Reveals multiple peaks clearly
OutliersMarked explicitlyVisible in tails
Best forQuick comparisonsDistribution analysis
SpaceCompactWider

When to Use Each

  • Use a box plot when you need a clean, compact summary and want to compare many groups at once.
  • Use a violin plot when you need to see the full distribution shape, especially to spot bimodal or multi-modal patterns.

Outlier Detection Methods

IQR Method (Tukey Fences)

The most common method. Any data point outside [Q1 − 1.5×IQR, Q3 + 1.5×IQR] is flagged as an outlier.

Z-Score Method

Values with a Z-score greater than 3 (or less than −3) are considered outliers. This assumes the data is approximately normally distributed.

Which Method to Use?

  • IQR: Robust, non-parametric. Works well for skewed data.
  • Z-score: Works best for normally distributed data.
  • Use both for a comprehensive analysis.

Statistics Glossary

Mean
The arithmetic average: sum of all values divided by count.
Median
The middle value when data is sorted. 50th percentile.
Mode
The most frequently occurring value in a dataset.
Quartile
Values that divide sorted data into four equal parts (Q1, Q2, Q3).
IQR (Interquartile Range)
Q3 minus Q1. Measures the spread of the middle 50%.
Standard Deviation
Square root of the average squared deviation from the mean. Most common measure of spread.
Variance
The average of squared deviations from the mean (σ²). Standard deviation squared.
Skewness
Measures asymmetry. Positive = tail to right, negative = tail to left.
Kurtosis
Measures 'tailedness'. High kurtosis = heavy tails, more outliers.
Percentile
The value below which a given percentage of observations fall.
KDE (Kernel Density Estimation)
A non-parametric way to estimate the probability density function of a variable.
Correlation
A measure of the linear relationship between two variables (ranges from -1 to +1).
Tukey Fences
Boundary for outlier detection: Q1−1.5×IQR and Q3+1.5×IQR.
Normal Distribution
A symmetric bell-shaped distribution defined by mean and standard deviation.