Averages hide most of the story: how to show the spread of your data honestly with histograms, box plots and density

TL;DR

Difficulty: Intermediate

An average is honest only when the data sits close together, and business data rarely does.

  • Run two checks first: is about one value in ten near the average, and is the gap between mean and median under 10%? If not, show the shape.
  • Histograms: try three bin widths, distrust the software default and put bin edges on the numbers customers react to, like a free delivery threshold.
  • Use a cumulative curve for promises and service levels, box plots to compare groups, violins or raw points when a box could hide a second peak, ridgelines for many months.
  • Outliers in a box plot mean look closer, not delete.
  • Never show the spread of individual values as a bar of the average.

Average order value: £41. It sounds like a fact about your customers, and it may describe almost none of them. This chapter shows how to see and show the real shape of your numbers, from the histogram to the ridgeline, and what one coffee roaster learns once the average is set aside.

The average order that almost nobody places

Every monthly report has one: "average order value: £41". It looks like a fact about your customers. Often it is a fact about nobody.

An average squeezes thousands of numbers into one. That helps when the numbers sit close together and misleads when they do not. Order values, delivery times, customer lifetimes, basket sizes, time on site: almost every number a business cares about is lopsided, with a crowd of small values and a long tail of large ones. The average of a lopsided crowd lands somewhere in between, often in a gap where hardly anyone actually is.

This chapter answers one question: how do I show the spread of my data honestly? You will learn what each common display (histogram, density plot, cumulative curve, quantile plot, box plot, violin, strip chart and ridgeline) shows, what it hides, and which settings quietly change the picture. Every idea is worked through on one invented business. If you have not read the chapter on showing amounts and proportions, it helps to read it first, because a bar of an average is exactly the chart this chapter takes apart.

Example: Ridgeway's £41 order, and the empty middle test

Ridgeway Coffee is an invented speciality roaster in Oxford (ridgewaycoffee.example). It turns over £2.4 million a year: subscriptions 45%, one off online orders 25%, wholesale to 140 cafés 30%. Maya, the founder, reads in the monthly pack that the average one off online order is £41. Joe, the analyst, pulls the year's orders: 14,600 of them, worth about £600,000 (that is the 25%).

Joe runs a test I use before any average goes into a report. I call it the empty middle test: what share of the values sits within 10% either side of the average? If the average describes a typical order, a good share of orders should be near it.

  • The average is £41. Within 10% either side means £37 to £45.
  • Only about 9% of Ridgeway's orders fall in that window.
  • The median, the middle order, is £32. Within 10% either side, £28.80 to £35.20, sit about 20% of orders, more than twice as many.

So the £41 order is something Ridgeway's customers rarely place. The number is not wrong. It is the right answer to a question nobody asked. The rest of this chapter shows what the right picture looks like, and what Maya learns from it.

My rule of thumb: if fewer than one value in ten sits within 10% of the average, never print the average on its own. Show the distribution. The threshold is a judgement, not a theorem, but it has a reason: in a roughly symmetric, single peaked distribution the middle band is the most crowded part of the chart, so a nearly empty middle is a reliable sign that the shape is lopsided or has more than one peak.

What "typical" means: mean, median and mode

There are three classic answers to "what is a typical value?", and they answer different questions.

  • The mean adds every value and divides by how many there are. It is the only one of the three that multiplies back to the total, so it is the right number for planning revenue. See Foundations: mean.
  • The median is the middle value once everything is sorted: half the values are below it, half above. It answers "what does a typical order look like?" and it barely moves when a few huge orders arrive. See Foundations: median and mode.
  • The mode is the most common value, or for continuous numbers like money, the most crowded range.

The mean of nn values is

xˉ=1n∑i=1nxi\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i

where xˉ\bar{x} is the mean, xix_i is the iith value and nn is the number of values (Foundations: mean).

For the median, sort the values so that x(1)≤x(2)≤⋯≤x(n)x_{(1)} \le x_{(2)} \le \dots \le x_{(n)}. Then

x~={x((n+1)/2)if n is odd12(x(n/2)+x(n/2+1))if n is even\tilde{x} = \begin{cases} x_{((n+1)/2)} & \text{if } n \text{ is odd} \\[4pt] \tfrac{1}{2}\left(x_{(n/2)} + x_{(n/2+1)}\right) & \text{if } n \text{ is even} \end{cases}

where x~\tilde{x} is the median, x(k)x_{(k)} is the kkth smallest value and nn is the number of values (Foundations: median and mode).

Example: seven orders on a Tuesday morning

Joe takes seven Ridgeway orders from one morning: £12, £19, £31, £32, £34, £58 and £120. They are already sorted, and n=7n = 7 is odd, so the median is the fourth value:

x~=x(4)=32\tilde{x} = x_{(4)} = 32

where x(4)x_{(4)} is the fourth smallest order, £32.

The mean adds all seven and divides by seven:

xˉ=12+19+31+32+34+58+1207=3067=43.71\bar{x} = \frac{12 + 19 + 31 + 32 + 34 + 58 + 120}{7} = \frac{306}{7} = 43.71

where the seven numbers in the top line are the order values in pounds and 77 is nn. One grinder order of £120 pulls the mean £11.71 above the median. Remove it and the mean of the other six is £31, while the median only moves from £32 to £31.50. That asymmetry is the whole story of skewed data in one line: the mean follows the tail, the median stays with the crowd.

For the whole year, the same arithmetic gives a median of £32 and a mean of £41.20. And the mean still earns its place: 14,600 orders times £41.20 is £601,520, which is the online revenue line. Use the mean when you need a total, the median when you need a typical case, and show the shape whenever the two disagree.

The mean minus median alarm

There is a quick way to know whether the two disagree enough to matter. Divide the gap between them by the median:

g=xˉ−x~x~g = \frac{\bar{x} - \tilde{x}}{\tilde{x}}

where gg is the relative gap, xˉ\bar{x} the mean and x~\tilde{x} the median (Foundations: median and mode).

This is my own rule of thumb, not a textbook test: below about 5%, the average is a fair summary. Between 5% and 10%, mention the median too. Above 10%, the data is lopsided enough that a single number will mislead someone, so show the distribution. Statisticians have more formal measures of skew, but the relative gap has one advantage in a meeting: anyone can compute it in their head.

Example: four Ridgeway numbers through the alarm

NumberMeanMedianGap ggVerdict
One off order value£41.20£3229%show the distribution
Subscription delivery value£25£244%the average is fine
Wholesale order value£129£11017%show the distribution
Delivery time2.4 days2 days20%show the distribution

The calculation for the first row:

g=41.20−3232=0.29g = \frac{41.20 - 32}{32} = 0.29

where 41.2041.20 is the mean and 3232 the median, both in pounds. Three of Ridgeway's four headline numbers fail the alarm. That is normal for a real business, and it is why this chapter exists.

Spread: quartiles and the interquartile range

A typical value is half the story. The other half is how far the values wander from it. The robust measure of spread, the one that pairs naturally with the median, is the interquartile range (IQR).

Sort the values and cut them into four equal groups. The cut points are the quartiles: Q1Q_1 has a quarter of the values below it, Q2Q_2 is the median, Q3Q_3 has three quarters below it. The IQR is the width of the middle half:

IQR=Q3−Q1\text{IQR} = Q_3 - Q_1

where Q1Q_1 is the first quartile (25th percentile), Q3Q_3 the third quartile (75th percentile) and IQR\text{IQR} the interquartile range. See Foundations: spread.

The standard deviation is the other common measure of spread, but it squares every distance from the mean, so a handful of large orders inflate it. The IQR ignores the outer quarters entirely, which is why it describes the crowd rather than the tail.

One practical warning. There is no single agreed way to compute a quartile from a sample. Rob Hyndman and Yanan Fan counted nine definitions in use across statistical software1, and spreadsheet functions such as QUARTILE.INC and QUARTILE.EXC in Excel give different answers on the same data. On 14,600 orders the difference is pennies. On 12 orders it can be pounds. If two reports disagree on a quartile, check the method before you check the data.

Example: the middle half of Ridgeway's orders

Joe finds Q1=£20Q_1 = £20 and Q3=£47Q_3 = £47 for the year's one off orders, so

IQR=47−20=27\text{IQR} = 47 - 20 = 27

where 4747 and 2020 are the third and first quartiles in pounds. The middle half of Ridgeway's orders spans £27, from £20 to £47. Add the 10th and 90th percentiles (£14 and £89) and Maya has a five number picture that a single average never gave her: one order in ten is below £14, one in four below £20, half below £32, three in four below £47, nine in ten below £89.

The histogram: counting values in bins

The histogram is the oldest and still the most widely understood picture of a distribution. Cut the range of values into intervals of equal width, called bins, count how many values fall into each, and draw a bar for each count. Claus Wilke stresses that the bins must be equally wide for the picture to be a valid histogram2: the eye reads the area of a bar, so a bin twice as wide would look like twice as many orders.

The histogram has one setting that changes everything: the bin width. Too narrow, and the chart turns into a comb of random spikes that hides the main shape. Too wide, and real features dissolve into a few blocks. Wilke's advice is simply to always try several widths2, and Kieran Healy makes the same point when teaching ggplot2, whose histogram warns you that it picked 30 bins for you and invites you to pick a better width3.

Example: the same 14,600 orders at three bin widths

Ridgeway offers free delivery on orders of £30 or more (an invented detail for this example). Joe draws the histogram three times.

Bins of £20. The chart shows a big block from £20 to £40 (6,126 orders), a smaller block below, and a long tail fading to the right. It reads as one smooth hill with a tail. Nothing in it looks worth a meeting.

Histogram of 14,600 one off online orders at Ridgeway Coffee, an invented example, in bins of 20 pounds. 0 to 20: 3,829 orders. 20 to 40: 6,126. 40 to 60: 2,114. 60 to 80: 868. 80 to 100: 409. 100 to 120: 516. 120 to 140: 419. 140 to 160: 196. 160 to 180: 74. 180 to 200: 29. A further 20 orders above 200 pounds are not shown. At this width the chart looks like one hill with a tail. Tap or click to enlarge

Bins of £10, with an edge at £30. Two things appear. There is a cliff at £30: 2,400 orders between £20 and £30, then 3,726 between £30 and £40. And there is a second, smaller hill between £100 and £130, after a dip around £90. The first is customers topping up their basket to reach free delivery. The second is a separate kind of order altogether: grinders, brewers and gift boxes.

Histogram of the same 14,600 one off orders at Ridgeway Coffee, an invented example, in bins of 10 pounds with an edge at the 30 pound free delivery threshold. 0 to 10: 255. 10 to 20: 3,574. 20 to 30: 2,400. 30 to 40: 3,726. 40 to 50: 1,287. 50 to 60: 827. 60 to 70: 531. 70 to 80: 337. 80 to 90: 225. 90 to 100: 184. 100 to 110: 240. 110 to 120: 276. 120 to 130: 240. 130 to 140: 179. 140 to 150: 119. 150 to 160: 77. 160 to 170: 47. 170 to 180: 27. 180 to 190: 18. 190 to 200: 11. 20 orders above 200 pounds are not shown. Orders jump at 30 pounds, and a second hill of equipment and gift orders peaks between 110 and 120 pounds. Tap or click to enlarge

Bins of £1. Now the cliff is a wall: 664 orders between £25 and £30, 2,705 between £30 and £35, most of them within a pound or two of £30. But the chart is also full of spikes at the exact totals of popular bag combinations, and the equipment hill breaks up into single bars of a few orders each. It is too busy to show anyone, though it is useful to Joe, because it proves the cliff is real and sits exactly at the threshold.

The £10 version is the one Maya sees. The £20 version would have told her nothing. The £1 version would have told her too much.

Five tools, five default histograms

Here is a finding that surprises most teams: if you never choose a bin width, your software chooses one for you, and different tools choose very differently. The rules behind the defaults come from statistics, and each has a reason.

  • Sturges' rule (1926) sets the number of bins to 1+log⁡2n1 + \log_2 n4. R's hist() function uses it by default5. It was designed for small samples from bell shaped data, and with large samples it produces far too few bins6.
  • Scott's rule (1979) sets the width to about 3.49 s n−1/33.49\,s\,n^{-1/3}, where ss is the standard deviation7. Excel's automatic histogram bins use Scott's normal reference rule8.
  • The Freedman and Diaconis rule (1981) uses the IQR instead of the standard deviation, so the tail does not inflate it9.
  • A fixed count. ggplot2 starts with 30 bins3, and matplotlib's hist() with 1010.

The Freedman and Diaconis width is

h=2⋅IQR⋅n−1/3h = 2 \cdot \text{IQR} \cdot n^{-1/3}

where hh is the bin width, IQR\text{IQR} the interquartile range and nn the number of values (Foundations: spread). The factor n−1/3n^{-1/3} makes the bins narrower as you get more data, but slowly: eight times the data halves the width.

Michael Minnotte, Stephan Sain and David Scott, writing in the Handbook of Data Visualization, explain why the rules disagree: Sturges' rule grows the number of bins far more slowly than the theory says it should, and even the better rules assume a roughly bell shaped curve, so they tend to oversmooth anything more complicated6. Their practical advice is the one worth remembering: look at a series of histograms with different widths, and give more credence to features that appear in most of them than to features that appear only once6.

Example: Ridgeway's orders through five defaults

Joe's orders run from £6 to £249, with n=14,600n = 14{,}600, a standard deviation of £33.07 and an IQR of £27. The cube root of 14,600 is 24.44.

Tool or ruleHow it decidesBin width for RidgewayWhat Maya would see
matplotlib default10 bins across the rangeabout £24one hill, no cliff, no second hill
Sturges, R default1+log⁡214,600=14.81 + \log_2 14{,}600 = 14.8, so 15 binsabout £16one hill, a faint bump in the tail
ggplot2 default30 bins across the rangeabout £8cliff visible if an edge lands near £30
Scott, Excel automatic3.49×33.07/24.443.49 \times 33.07 / 24.44about £4.70cliff and second hill both visible
Freedman and Diaconis2×27/24.442 \times 27 / 24.44about £2.20cliff sharp, tail noisy

The Freedman and Diaconis calculation in full:

h=2×2724.44=2.21h = \frac{2 \times 27}{24.44} = 2.21

where 2727 is the IQR in pounds and 24.4424.44 is 14,6001/314{,}600^{1/3}.

Same data, five pictures, and two of them would have hidden both findings. The cliff at £30 and the second hill each appear in at least three of the five, so by the Handbook's test both deserve to be believed. The lesson is not "use Scott's rule". It is: the default is a guess made by someone who has never seen your data. Treat it as the first of several drafts.

Put bin edges where decisions are made

The bin width gets all the attention, but where the bins start matters too. Minnotte and colleagues note that the position of the edges matters less in theory than the width, yet can have a large visual effect at moderate sample sizes, and that when the data has a known break (zero is the usual one), an edge should sit exactly on it6. Antony Unwin makes a related point in the same Handbook: what the data represent and how they were collected should guide the choice of scales, and optimality formulas only play a minor role11.

I take that one step further for business data. Your data has breaks that no formula knows about: a free delivery threshold, a price point, a promise of "three working days", a contract minimum. Customers and processes react to those lines, so the data piles up or thins out exactly there. My rule: put a bin edge on every number that a customer, a contract or a promise cares about. A histogram with edges on decision lines shows the reaction to the decision. A histogram with edges anywhere else blurs it.

Example: the same £10 bins, shifted by £5

Joe redraws the £10 histogram with edges at £5, £15, £25, £35 instead of £10, £20, £30, £40. Same width, same data.

  • £15 to £25: 3,778 orders.
  • £25 to £35: 3,369 orders.
  • £35 to £45: 1,736 orders.

The bar that contains the threshold now mixes the quiet stretch just below £30 with the crowd just above it. It ends up lower than its neighbour on the left, and the cliff disappears. Nothing about the data changed, only where Joe started counting. With the edge at £30, Maya sees that 2,705 orders sit between £30 and £35 against 664 between £25 and £30: about four times as many orders just above the line as just below it. That is the free delivery threshold working, and it gives her a concrete question to test next: what would happen at £35?

Density plots and the bandwidth problem

A density plot replaces the bars with a smooth curve. The usual method, kernel density estimation, places a small bump (the kernel, usually a bell curve) on every single value and adds all the bumps up2. The width of each bump is called the bandwidth, and it plays exactly the role the bin width plays in a histogram: too small and the curve is jittery, too large and real features are smoothed away2. The curve has no bin edges, which removes one arbitrary choice, and Wilke argues that density curves compare better than histograms when you show several groups at once, because overlapping lines stay readable where overlapping bars do not2.

Three warnings come with it.

  1. The bandwidth is a choice, and the automatic ones are not neutral. Minnotte and colleagues point out that the common normal reference bandwidth oversmooths most distributions that are not bell shaped, and that automatic selectors can be unstable and should not replace a skilled analyst looking at several versions6. Adrian Bowman, writing about smoothing in the same Handbook, recommends plotting the estimate over a wide range of smoothing parameters to see what each level of smoothing does12.
  2. Density curves invent data at the edges. Because every value gets a bell shaped bump, the curve spills past the smallest and largest values, sometimes into impossible territory such as negative prices. Wilke tells you to always check that the curve does not show values that cannot exist2.
  3. The vertical axis is hard to read. The curve is scaled so the area under it is 1, so the height depends on the units of the horizontal axis. Readers outside statistics cannot interpret "density 0.012 per pound", so for a business audience either label the axis as relative frequency or leave the numbers off and say so2.

Is the histogram or the density plot better? Wilke reports that the question splits people sharply: some regard density curves as arbitrary and misleading, others point out that histograms are just as arbitrary, and he himself treats it largely as a matter of taste2. My view: for a single distribution shown to a business audience, use the histogram, because everyone can read "number of orders" on the axis and nobody can read "density". Use density curves when you compare three or more groups on one chart, and only with enough data, a few hundred values per group at least, so that the curve reflects the data rather than the kernel.

Example: delivery times are the wrong data for a curve

Joe is tempted to draw a density curve of delivery times. It would be a mistake, and the reason is worth knowing. Delivery time at Ridgeway is counted in whole working days: 1, 2, 3 and so on. A smooth curve across those values would show parcels arriving after 1.5 or 2.7 days, which never happens, and with a default bandwidth it would draw a tail below one day. For counts of whole units, the honest display is a bar for each possible value.

Share of about 57,800 parcels a year to private customers at Ridgeway Coffee, an invented example, by working days to delivery. 1 day: 22%. 2 days: 38%. 3 days: 28%. 4 days: 7%. 5 days: 3%. 6 or more days: 2%. The median is two working days and 12% of parcels take more than three working days. Tap or click to enlarge

The parcels here are the 14,600 one off orders plus about 43,200 subscription deliveries a year (3,600 subscribers, about one delivery a month), roughly 57,800 in all. The average delivery time is

xˉ=1(0.22)+2(0.38)+3(0.28)+4(0.07)+5(0.03)+6.5(0.02)=2.38\bar{x} = 1(0.22) + 2(0.38) + 3(0.28) + 4(0.07) + 5(0.03) + 6.5(0.02) = 2.38

where xˉ\bar{x} is the average delivery time, each number outside the brackets is a delivery time in working days (6.5 stands in for "6 days or more") and each number inside is the share of parcels at that time. "Average delivery: 2.4 days" sounds excellent. The chart shows what the average hides: 12% of parcels, about 6,900 a year, take four days or more. The share is the same for first deliveries to new subscribers. Whether that tail matters is a question for later in this series. For now, note that the average made it invisible.

Cumulative distributions: read the promise straight off the chart

Wilke describes a display that needs no bin width and no bandwidth at all: the empirical cumulative distribution function (ECDF)13. Sort the values, and for each possible value plot the share of data at or below it. The line climbs from 0 to 1 (or 0% to 100%). Because nothing is binned or smoothed, it shows the data itself rather than an interpretation of it13.

Its weakness is that people find it less intuitive than a histogram, and Wilke notes it is rarely seen outside technical work13. Its strength is that it answers threshold questions directly. "What share of parcels arrive within three days?" is a single reading on the vertical axis. Wilke also describes the descending version, which plots the share at or above each value, and recommends it for heavily skewed data13. For a business, the descending curve is a "still waiting" chart: what share of parcels has not arrived after dd days?

Example: Ridgeway's delivery promise as an ECDF

Joe adds the shares from the delivery chart from left to right:

Working daysShare delivered that dayShare delivered by thenShare still waiting
122%22%78%
238%60%40%
328%88%12%
47%95%5%
53%98%2%
6 or more2%100%0%

Plotted as a step line, the third column is the ECDF. Maya can now read her service levels without arithmetic: 60% of parcels arrive within two working days, 88% within three. If the website promises "delivered within three working days", one parcel in eight breaks the promise. A histogram shows the same data, but the ECDF puts the answer to the promise question in one place on the chart. When a promise, a target or a service level is the subject, I reach for the cumulative curve first.

Quantile plots: is the shape what you think it is?

A quantile quantile plot (QQ plot) compares your data with a reference shape. Each sorted value is plotted against the value you would expect at the same rank if the data followed the reference distribution exactly. If the points fall on the diagonal, the data has that shape. Where they bend away from it, the data differs, and the direction of the bend tells you how13. The method goes back to Martin Wilk and Ram Gnanadesikan's 1968 paper on probability plotting14.

QQ plots are an analyst's tool rather than a presentation tool. They belong in the exploration, where they answer questions such as "can I treat this as bell shaped?" or "is this lopsided in the way a log normal distribution is lopsided?". Wilke shows the related trick for heavily skewed data: take the logarithm of the values first, and a long right tail often turns into a readable, nearly symmetric shape13. If you put such a chart in front of a business audience, label the axis in real pounds at log spaced ticks (£10, £30, £100, £300) rather than in logarithms. The chapter on scales, axes and coordinate systems covers log scales in detail.

Example: Joe checks the shape before choosing a model

Joe plots the logarithm of order values against a normal reference. Most points lie close to the diagonal, which tells him order values are roughly log normal: multiplicative, like most money amounts. Two departures stand out. There is a flat step at £30, where far more orders sit than the reference expects (the free delivery pile again), and the top end bends upwards, where the equipment orders are larger and more frequent than a single log normal shape allows. Joe keeps this chart to himself. It tells him that a forecast built on one smooth curve would underestimate the equipment business.

The box plot, part by part

When you need to compare several distributions side by side, the histogram becomes crowded. The box plot was made for this. John Tukey introduced it in his book Exploratory Data Analysis (1977)15, and it became popular because it was informative and easy to draw by hand16. Each part has a fixed meaning:

  • The line in the box is the median.
  • The box runs from Q1Q_1 to Q3Q_3, so it holds the middle half of the values. Its height is the IQR.
  • The whiskers reach out to the most extreme values that still lie within 1.5 IQR of the box. These limits are called the fences16.
  • The dots beyond the whiskers are the values outside the fences, usually called outliers16.

The fences in formula form:

Flow=Q1−1.5 IQR,Fhigh=Q3+1.5 IQRF_{\text{low}} = Q_1 - 1.5\,\text{IQR}, \qquad F_{\text{high}} = Q_3 + 1.5\,\text{IQR}

where FlowF_{\text{low}} and FhighF_{\text{high}} are the lower and upper fences, Q1Q_1 and Q3Q_3 the quartiles and IQR\text{IQR} the interquartile range. See Foundations: spread.

Why 1.5? It is a convention Tukey chose, not a law. For bell shaped data it flags well under 1% of values, so a dot is a genuine surprise. For lopsided data it flags many more, and that is where business readers go wrong. In Tukey's sense an "outlier" means "look at this", never "delete this". Robert McGill, John Tukey and Wayne Larsen later proposed useful variations: box widths in proportion to the square root of each group's size, so a box from 20 values does not look as solid as a box from 20,000, and notches around the median that give a rough sense of whether two medians differ17.

Wilke shows why the box plot is better than the bar or point with error bars it usually replaces: it shows more of the distribution, its parts have one standard meaning, and it reveals skew, which symmetric error bars cannot16.

Example: Ridgeway's three channels as box plots

Joe compares the order values of the three channels. The figures below are derived for this example from the business's revenue split: about 43,200 subscription deliveries averaging £25, about 14,600 one off orders averaging £41.20, and about 5,600 wholesale orders (140 cafés ordering most weeks) averaging £129.

Channel10th percentileQ1Q_1MedianQ3Q_390th percentile
Subscription deliveries£16£19£24£29£34
One off online orders£14£20£32£47£89
Wholesale orders£45£70£110£165£240
Grouped bars of order value percentiles for Ridgeway Coffee's three channels, an invented example. Subscription deliveries: 10th percentile 16, first quartile 19, median 24, third quartile 29, 90th percentile 34 pounds. One off online orders: 14, 20, 32, 47 and 89 pounds. Wholesale orders: 45, 70, 110, 165 and 240 pounds. Subscriptions are narrow and predictable, one off orders have a long upper tail, wholesale orders are large and widely spread. Tap or click to enlarge

The blog cannot draw a true box plot, so the chart above shows the same five numbers as grouped bars. Read each group as a box plot laid on its side: the median bar is the line in the box, the quartile bars are the box edges, the outer bars stand in for the whiskers.

Now the fences for one off orders:

Fhigh=47+1.5×27=87.50F_{\text{high}} = 47 + 1.5 \times 27 = 87.50

where 4747 is Q3Q_3 and 2727 the IQR, both in pounds. The lower fence is 20−40.5020 - 40.50, below zero, so the lower whisker simply runs down to the smallest order. About 1,500 orders, roughly one in ten, sit above £87.50 and would be drawn as outlier dots. A careless reader would call them noise. They are the grinders and gift boxes from the second hill in the histogram, and at an average of about £124 each they bring in roughly a third of online revenue. The box plot correctly flagged them as different. Only the histogram showed that they form a group of their own.

What Maya learns from the three boxes: subscription revenue is narrow and predictable, which is why it is the base of the business. Wholesale orders are large and widely spread, so a few cafés matter a lot. One off orders have a typical value of £32 and a valuable tail that an average blends away.

What a box plot hides

The box plot summarises a distribution in five numbers, and five numbers cannot show everything. Above all, a box plot cannot show more than one peak. Justin Matejka and George Fitzmaurice built sets of data that look completely different as raw points yet share exactly the same box plot18. It is the box plot's version of the older lesson from Francis Anscombe's 1973 quartet, four small sets of data with nearly identical summary statistics and completely different scatter plots19, which Healy uses to open his book20.

Three displays fill the gap.

  • Violin plots, proposed by Jerry Hintze and Ray Nelson in 1998, combine the box plot with a density curve, mirrored on both sides21. A wide part of the violin is where the values crowd, so two peaks show as two bulges. Wilke's caution: since a violin is a density estimate, it needs enough data in each group, and it inherits the density plot's habit of suggesting values where there are none16.
  • Strip charts draw every value as a dot along one axis. When dots pile up on top of each other, spreading them sideways at random, called jittering, makes the crowd visible16.
  • Sina plots spread the dots sideways in proportion to how crowded each level is, so the cloud of points takes the outline of a violin16. Micah Allen and colleagues proposed the related raincloud plot, which places a half violin, a box plot and the raw points side by side22.

Example: the second hill the box plot missed

Joe draws one off order values as a box plot and as a violin, side by side. The box plot shows a box from £20 to £47 and a scatter of dots above £87.50: it looks like one lopsided group with a messy tail. The violin shows two bulges, a fat one around £30 and a slim one around £110 to £120, with a waist between them near £90. Those are two kinds of customer: people buying coffee, and people buying equipment or gifts. With 14,600 orders, the violin has more than enough data to be trusted. Joe would not draw a violin for the 140 cafés' annual spend, for the reason in the next section.

When to show every point

Sometimes the best summary is no summary. Tracey Weissgerber and colleagues reviewed 703 papers in leading physiology journals and found that most showed continuous data as bar and line graphs, although many different distributions can produce the same bar graph23. Their recommendation was to show the individual values, especially when samples are small23.

The logic is simple. A summary saves the reader effort when there are too many values to look at. When there are few, the summary costs more than it saves: it hides individuals the reader could easily have seen. Wilke gives the matching advice: when there is too little data to justify a smooth violin, plot the raw points instead16.

My rule of thumb: under about 100 values per group, show every value (jittered if they collide), and add the median as a line. Between about 100 and a few thousand, show the points faintly behind a box plot. Above that, use a histogram, a violin or a box plot, because individual points become a blur.

Example: 140 cafés, 140 dots

Joe wants to show Maya how wholesale revenue is spread across the 140 cafés. The mean is £5,143 a year (£720,000 divided by 140). A box plot would summarise 140 businesses in five numbers. Instead he draws a strip chart: one dot per café, jittered sideways, with a line at the median of £3,900 (derived for this example). The chart shows something no summary would: ten cafés each spend over £12,000 a year and stand clear of the crowd, and Maya recognises every one of them. A summary turns those ten into "outliers". As dots, they become ten relationships to protect.

Many distributions at once: ridgeline plots

To compare many distributions, Wilke recommends drawing the value along the horizontal axis and stacking one density curve per group, slightly overlapping, down the page16. The result is called a ridgeline plot, because it looks like a row of mountain ridges. It works especially well for changes over time, such as months or years, and it scales to dozens of groups that would be unreadable as overlapping curves on one chart16. Wilke advises against using stacked histograms in place of the curves, because bars from neighbouring rows line up and blur together16.

The same chapter explains why overlapping histograms fail even for two groups: a semi transparent bar on top of another looks like a third colour, and readers cannot tell where each bar starts2. For exactly two groups, an alternative is two histograms back to back, the population pyramid layout2.

Example: twelve months of order values

Joe draws one curve of one off order values for each month, January at the top, December at the bottom. Most months look alike: a peak just above £30 and a small hump above £100. Two rows break the pattern (figures derived for this example). December's hump is much bigger: 19% of December orders are above £90, against 8% in July, and December's median rises to £36 against £30 in July. Maya already knows December sign ups run at 2.6 times the monthly average because of gifts. The ridgeline adds what the count cannot: the gift season changes what people order, not just how many. July and August show the smallest equipment humps of the year. Twelve monthly averages would have shown December rising and nothing about why.

Why not just a bar of the average with error bars?

The most common way to "show variation" in business slides is a bar for each group's average, with a thin error bar on top. It is also one of the weakest displays available.

  • The bar implies the data lives inside it. George Newman and Brian Scholl found that people shown a bar of a mean judge values inside the bar as more likely than values equally far above it, as if the bar contained the data24. They call it the within the bar bias, and it occurred with and without error bars24.
  • Nobody knows what the error bar means. It might be one standard deviation, two, the standard error, or a 95% confidence interval. Wilke points out that there is no common standard, that readers confuse the spread of the data with the precision of the average, and that symmetric bars misrepresent skewed data16. Michael Correll and Michael Gleicher showed in crowdsourced experiments that the way the mean and its error are drawn changes the decisions people make, and recommended gradient plots and violin plots over bars with error bars25.
  • Many distributions give the same bar. That was Weissgerber's central finding23.

The fair case for the bar: it is familiar, it fits on a crowded slide, and when the thing you are comparing really is a total or a rate, a bar is right (the chapter on amounts and proportions covers that). Cole Nussbaumer Knaflic shows a practical middle ground for business audiences in Storytelling with Data: a line for the average with a shaded band for the minimum to the maximum, so the range is visible without a statistics lesson26.

My view: when the subject is the spread of individual values, never use a bar of the average. Use the histogram, the box plot or the points. I would adapt Knaflic's band in one way: shade from the 10th to the 90th percentile rather than from the minimum to the maximum. The minimum and maximum are each a single, often freak, order, so the band's width would depend on two values out of thousands. Percentiles describe the customers, not the accidents.

Example: Ridgeway's monthly order value, as a band

Maya's monthly pack showed average order value as a line: about £41 every month, a little higher in December. Joe replaces it with three lines over the year: the median, and a shaded band from the 10th to the 90th percentile. For most months the band runs from about £14 to about £89 with the median near £32. In December the upper edge of the band jumps well above £100 while the median rises only a few pounds. Now the chart says what changed: the gift orders, not the everyday coffee. With the minimum and maximum instead, the band would have been set by one £249 order in March and one £6 order in August, and would have meant nothing.

Which display for which question

Every display above is good at something. The table sums them up.

DisplayBest forHides or risksSettings to check
Histogramone distribution for any audiencefeatures smaller than the bin widthbin width, edges on thresholds
Density plotthree or more groups on one chartvalues that do not exist, unreadable axisbandwidth, cut at real limits
ECDFthresholds, promises, service levelsthe shape is harder to seenone
QQ plotchecking a shape before modellingmeaningless to most audiencesreference distribution, log scale
Box plotcomparing many groups compactlymore than one peak, group sizesquartile method, what dots mean
Violinmany groups where shape mattersneeds a few hundred values per groupbandwidth
Strip chart, jitteredfewer than about 100 values per groupbecomes a blur with many pointsjitter width, transparency
Ridgelinemany groups or many periodsprecise valuesbandwidth, order of the rows
Average with 10th to 90th percentile bandtrends for business audiencesthe shape inside the bandwhich percentiles

And the same choice as a decision path:

Tap or click to enlarge

Explore with many charts, explain with one

Knaflic draws a distinction that matters here more than anywhere: exploratory analysis is the work you do to understand the data, explanatory analysis is what you show an audience once you know what matters27. Distributions demand a lot of exploration. Three bin widths, a shifted edge, a QQ plot, a violin next to a box plot: that is a dozen charts, and most of them should never leave the analyst's screen. What reaches the decision maker is the one chart that shows the finding, with the threshold marked and a title that states the point. The chapter on the context, the audience and the big idea is about that last step.

Example: the two charts that reach the founder

Out of the charts above, Joe sends two:

  1. The £10 histogram with the edge at £30, titled "A quarter of one off orders land between £30 and £40, just above the free delivery line, and one in ten is equipment or a gift". The £30 line is marked and the two groups are labelled on the chart.
  2. The delivery ECDF, titled "88% of parcels arrive within three working days. One in eight does not". The three day line is marked.

Everything else, the five defaults, the QQ plot, the violin, the shifted bins, stays in Joe's notes as the evidence behind those two charts.

What Maya learned that the average hid

Put together, the distributions told Maya five things that "average order: £41" and "average delivery: 2.4 days" never could:

  1. The typical order is £32, not £41. Planning promotions or packaging around a £41 customer would aim at a gap.
  2. Free delivery at £30 moves behaviour. About four times as many orders sit just above the line as just below it. The threshold is a lever she can test.
  3. There are two kinds of online customer. Roughly one order in ten is equipment or a gift at around £100 to £130, bringing in about a third of online revenue, and it peaks in December. That deserves its own range, its own pages and its own campaigns, not a footnote under "outliers".
  4. Wholesale depends on a few cafés. Ten of 140 spend over £12,000 a year each. Those relationships carry real weight.
  5. One parcel in eight takes more than three working days. The average of 2.4 days hid a tail of about 6,900 parcels a year, the same share among first deliveries to new subscribers. Later in this series, the chapter on exploring data follows that tail to see what it costs.

None of these findings needed new data. They were in the orders all along, flattened by a single number. If you want this kind of reading of your own figures, it is a core part of my Data Science work for clients.

Conclusion

An average is a summary, and a summary is only honest when the data it summarises is tightly grouped. Business data rarely is. Before you print an average, run two quick checks: the empty middle test (is about one value in ten or more near the average?) and the mean minus median alarm (is the gap under 10% of the median?). If either fails, show the shape.

For one distribution, draw a histogram, try at least three bin widths, distrust the default and put bin edges on the numbers your customers and promises care about. For thresholds and service levels, use the cumulative curve. To compare groups, use box plots, and remember that the dots beyond the whiskers are a reason to look, not a reason to delete. When the box plot might hide a second peak, check it with a violin or the raw points. When there are few values, show them all. When there are many groups or months, stack them as ridgelines. And never show the spread of individual values as a bar of the average.

If you want to see what your own order values, delivery times or customer numbers look like once the average is set aside, book the free workshop. We look at your data together, and the first two weeks of work are on me.

If you want to see what your own order values, delivery times or customer numbers look like once the average is set aside, book the free workshop: we read your distributions together, and the first two weeks of work are on me.

Sources

  1. 1.

    Rob J. Hyndman and Yanan Fan, Sample quantiles in statistical packages, The American Statistician 50 (4), 1996, pp. 361 to 365, https://doi.org/10.1080/00031305.1996.10473566

  2. 2.

    Claus O. Wilke, Fundamentals of Data Visualization, O'Reilly, 2019, chapter 7, Visualizing distributions: histograms and density plots, https://clauswilke.com/dataviz/histograms-density-plots.html

  3. 3.

    Kieran Healy, Data Visualization: A Practical Introduction, Princeton University Press, 2018, chapter 4, Show the right numbers, section on histograms and density plots, https://socviz.co/

  4. 4.

    Herbert A. Sturges, The choice of a class interval, Journal of the American Statistical Association 21 (153), 1926, pp. 65 to 66, https://doi.org/10.1080/01621459.1926.10502161

  5. 5.

    R Core Team, hist: Histograms, R documentation for the graphics package, https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/hist.html

  6. 6.

    Michael C. Minnotte, Stephan R. Sain and David W. Scott, Multivariate visualization by density estimation, in Chun houh Chen, Wolfgang Härdle and Antony Unwin (eds.), Handbook of Data Visualization, Springer, 2008, chapter III.5, pp. 390 to 397, https://doi.org/10.1007/978-3-540-33037-0

  7. 7.

    David W. Scott, On optimal and data based histograms, Biometrika 66 (3), 1979, pp. 605 to 610, https://doi.org/10.1093/biomet/66.3.605

  8. 8.
  9. 9.

    David Freedman and Persi Diaconis, On the histogram as a density estimator: L2 theory, Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete 57 (4), 1981, pp. 453 to 476, https://doi.org/10.1007/BF01025868

  10. 10.

    Matplotlib, matplotlib.pyplot.hist, Matplotlib 3.9.2 documentation, 2024, https://matplotlib.org/3.9.2/api/_as_gen/matplotlib.pyplot.hist.html

  11. 11.

    Antony Unwin, Good graphics?, in Chun houh Chen, Wolfgang Härdle and Antony Unwin (eds.), Handbook of Data Visualization, Springer, 2008, chapter II.2, pp. 65 to 66, https://doi.org/10.1007/978-3-540-33037-0

  12. 12.

    Adrian W. Bowman, Smoothing techniques for visualisation, in Chun houh Chen, Wolfgang Härdle and Antony Unwin (eds.), Handbook of Data Visualization, Springer, 2008, chapter III.9, p. 497, https://doi.org/10.1007/978-3-540-33037-0

  13. 13.

    Claus O. Wilke, Fundamentals of Data Visualization, O'Reilly, 2019, chapter 8, Visualizing distributions: empirical cumulative distribution functions and q q plots, https://clauswilke.com/dataviz/ecdf-qq.html

  14. 14.

    M. B. Wilk and R. Gnanadesikan, Probability plotting methods for the analysis of data, Biometrika 55 (1), 1968, pp. 1 to 17, https://doi.org/10.1093/biomet/55.1.1

  15. 15.

    John W. Tukey, Exploratory Data Analysis, Addison Wesley, 1977, https://archive.org/details/exploratorydataa00tuke_0

  16. 16.

    Claus O. Wilke, Fundamentals of Data Visualization, O'Reilly, 2019, chapter 9, Visualizing many distributions at once, https://clauswilke.com/dataviz/boxplots-violins.html

  17. 17.

    Robert McGill, John W. Tukey and Wayne A. Larsen, Variations of box plots, The American Statistician 32 (1), 1978, pp. 12 to 16, https://doi.org/10.1080/00031305.1978.10479236

  18. 18.

    Justin Matejka and George Fitzmaurice, Same stats, different graphs: generating datasets with varied appearance and identical statistics through simulated annealing, Proceedings of the 2017 CHI Conference on Human Factors in Computing Systems, ACM, 2017, pp. 1290 to 1294, https://doi.org/10.1145/3025453.3025912

  19. 19.

    F. J. Anscombe, Graphs in statistical analysis, The American Statistician 27 (1), 1973, pp. 17 to 21, https://doi.org/10.1080/00031305.1973.10478966

  20. 20.

    Kieran Healy, Data Visualization: A Practical Introduction, Princeton University Press, 2018, chapter 1, Look at data, https://socviz.co/

  21. 21.

    Jerry L. Hintze and Ray D. Nelson, Violin plots: a box plot density trace synergism, The American Statistician 52 (2), 1998, pp. 181 to 184, https://doi.org/10.1080/00031305.1998.10480559

  22. 22.

    Micah Allen, Davide Poggiali, Kirstie Whitaker, Tom Rhys Marshall and Rogier A. Kievit, Raincloud plots: a multi platform tool for robust data visualization, Wellcome Open Research 4:63, 2019, https://doi.org/10.12688/wellcomeopenres.15191.1

  23. 23.

    Tracey L. Weissgerber, Natasa M. Milic, Stacey J. Winham and Vesna D. Garovic, Beyond bar and line graphs: time for a new data presentation paradigm, PLOS Biology 13 (4), 2015, e1002128, https://doi.org/10.1371/journal.pbio.1002128

  24. 24.

    George E. Newman and Brian J. Scholl, Bar graphs depicting averages are perceptually misinterpreted: the within the bar bias, Psychonomic Bulletin and Review 19 (4), 2012, pp. 601 to 607, https://doi.org/10.3758/s13423-012-0247-5

  25. 25.

    Michael Correll and Michael Gleicher, Error bars considered harmful: exploring alternate encodings for mean and error, IEEE Transactions on Visualization and Computer Graphics 20 (12), 2014, pp. 2142 to 2151, https://doi.org/10.1109/TVCG.2014.2346298

  26. 26.

    Cole Nussbaumer Knaflic, Storytelling with Data: A Data Visualization Guide for Business Professionals, Wiley, 2015, chapter 2, Choosing an effective visual, pp. 46 to 47, https://www.storytellingwithdata.com/books

  27. 27.

    Cole Nussbaumer Knaflic, Storytelling with Data: A Data Visualization Guide for Business Professionals, Wiley, 2015, chapter 1, The importance of context, pp. 19 to 20, https://www.storytellingwithdata.com/books

Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.

Donate to Shelter