Box Plot: See a Distribution's Shape at a Glance
A box plot is a cheat sheet for a dataset's distribution, showing the median, the middle 50% of data (the box), and outliers. Use it to quickly compare distributions, like server response times across regions. The footgun: the line is the median, not the mean.
WHY IT EXISTS Raw numbers are hard to interpret. Histograms are great but can be cluttered when comparing many groups. We need a compact way to see a dataset's central tendency, spread, and skewness, especially when comparing multiple datasets at once.
THE MENTAL MODEL Think of a box plot as a compressed summary of a thousand data points. The box itself contains the 'body' of your data—the middle 50%. The line inside tells you the exact middle point (median). The 'whiskers' show you the reasonable range of your data, and anything outside that is an outlier worth investigating. It's a quick visual answer to 'What does this data look like?'.
HOW IT WORKS A box plot visualizes five key statistics. The bottom and top of the box are the first (Q1, 25th percentile) and third (Q3, 75th percentile) quartiles. The line inside the box is the median (Q2, 50th percentile). The distance between Q1 and Q3 is the Interquartile Range (IQR). The whiskers extend from the box to show the data's range, typically up to 1.5 times the IQR. Any data points beyond the whiskers are plotted individually as outliers.
WHEN TO USE IT Use box plots when you need to compare the distributions of several datasets at a glance. It's perfect for visualizing things like latency measurements across different services, salary ranges across job titles, or test scores between different student groups. It quickly reveals differences in median values, variance, and the presence of outliers.
WHEN NOT TO USE IT Box plots can hide the underlying distribution shape. A bimodal distribution (with two peaks) can look the same as a unimodal (one peak) or uniform distribution in a box plot. If the specific shape of the distribution is critical, a histogram or violin plot is a better choice. They are also less useful for very small datasets.
ONE CANONICAL EXAMPLE Imagine you're an SRE comparing API response times for three services: A, B, and C. A box plot for each service shows that Service A has a low median and a tight box (fast and consistent). Service B has a similar median but a very tall box and long whiskers (unpredictable performance). Service C has a high median and several points plotted as outliers (generally slow, with occasional extreme delays). This one chart tells you where to focus your optimization efforts.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.