In 2007 Roland Fryer published a study showing how candidates with “Afro-American” names received 50% less calls than candidates with “white” names. But what many did not highlight was the difference in the distribution of calls, not only in the average. The boxplot used by Fryer revealed that candidates with “Afro-American” names had a more compressed distribution and almost completely lacked calls from high-quality companies.
This example explains why the boxplot is basic: it does not replace the average, but shows what the average hides, that is the form of distribution, the concentration of values and the presence of anomalies. Two groups can have the same average but completely different distributions, and the boxplot makes it evident.
Anatomy of a boxplot: element by element
Invented by John Tukey in 1970, the boxplot is a tool to explore the data before confirming it. Consider the delivery times of 100 orders of an e-commerce:
Each element has a precise meaning:
| Item | Statistical definition | Practical significance |
|---|---|---|
| Median | 50th percentile | The real central point: half of orders arrive before this time |
| Q1 | 25° percentile | 25% of the fastest orders arrive within this time |
| Q3 | 75th percentile | 75% of orders arrive within this time |
| IQR | Q3 - Q1 | Variability of typical values, excluding extremes |
| Lower moustache | Q1, 1.5 × IQR | Lower limit of normal |
| Upper moustache | Q3 + 1.5 × IQR | Upper limit of normal |
| Outlier | Values beyond the mustache | Anomalies That Deserve Attention |
The mustache formula includes 99.3% of the values for a normal distribution.
A concrete example: e-commerce delivery times
An e-commerce with deliveries from 1 to 25 days shows a boxplot with median to 5 days, IQR from 3 to 8 days and outlier to 25 days. The average alone, for example 6 days, does not catch asymmetric distribution and important outliers that the boxplot makes evident.
Read each element: detailed in-depth
Quartiles
Quartles divide data into four equal parts, with the median representing the central value. The median is preferable to the mean when there are outliers that strongly affect it.
Interquartile interval (IQR)
The IQR measures the variability of the central data, excluding the 25% lower and 25% higher. A small IQR indicates consistency, a large one indicates high variability.
Mustache
Mustache delimites the “normal” range of data according to the Tukey formula. Values beyond mustache are rare and deserve attention.
Outlier
Outliers represent special cases to be investigated: orders in remote areas, exceptionally long customer service responses or very high purchases. They are not noise to ignore but opportunities or problems to analyze.
Why the boxplot beats the average: the quartet of anscombe
Francis Anscombe in 1973 showed four datasets with the same descriptive statistics but completely different distributions, demonstrating that the average and other summary statistics can deceive without visualization.
Example of two departments
Two departments with identical average sales (100 euros) can have very different distributions: one stable and predictable, the other with large oscillations and outliers. The boxplot makes this difference evident, basic for planning.
Boxplot vs. histogram vs. violin plot
| Display | Best use | Pros | Against |
|---|---|---|---|
| Boxplot | Comparison between 5-20 distributions | Compact, show clearly outlier | Hide the full form |
| Histogram | Analysis of 1-2 distributions | Show Detailed Shape | Difficult multiple comparison |
| Violin Plot | Combine boxplot and histogram | Show shape and quartile | More complex visually |
| Density Plot | Very smooth continuous data | Elegant, natural | Less precise on outliers |
If you have to compare multiple groups use boxplot, to understand the shape of a single distribution use histogram, for the best of the two worlds violin plot.
How to create boxplot in python
Base with matplotlib
One example shows three marketing channels with different distributions. Email marketing presents a bimodal distribution that the average does not represent well, but the boxplot clearly reveals it.
Advanced with seaborn
With a more realistic dataset, Seaborn allows you to create colored boxplots with overlapping points to see the real distribution, useful for discovering hidden structures.
Boxplot in SQL: calculate quartile with window functions
You can calculate quartiles, IQR, mustache and count outliers directly in SQL using functions such as PERCENTILE_CONT, allowing automatic and updated dashboards.
5 patterns to recognize immediately
- Tight box: concentrated data, stable and predictable process. 2. Wide box: high variability, unpredictable process. 3. Non-centered median: asymmetrical distribution, misleading mean. 4. Many outliers: cases to investigate, opportunities or problems. 5. Comparative boxplot: show median changes and variability.
When to use the boxplot
| Use when… | Avoid when… |
|---|---|
| Group Comparisons | Small samples, fewer than 20 per group |
| Outlier Circles | Time trend monsters |
| Continuous distribution analysis | Categoric data |
| Suspected differences not evident in the mean | Non-family audience with statistical graphs |
For non-technical audiences, prefer histograms or bar charts, for analytical teams use boxplot.
Three immediate applications in business
- Customer service response time: identify agents with inconsistent performance and outliers to investigate., AOV distribution: segment by channel to understand hidden differences from the media., Performance sellers: distinguish stable sellers from volatile ones for targeted interventions.
The basic lesson
Viewing data is an integral part of the analysis. The boxplot is the simplest and most useful tool to reveal the hidden structure behind the average. Before accepting an average, always ask to see the boxplot.
Relationship with the ginnytech course
To learn more, visit the modules Matthematic Data Analysis and Marketing Analysis that explain quantiles, percentili and practical applications.
