MathsStatistics & Probability

Box Plot
calculator.

Turn raw numbers into a box and whisker plot, and see which values stand apart.

How it's worked out

A box and whisker plot draws five numbers on one line. The box runs from the first quartile to the third, a line marks the median, and whiskers reach out on each side. About a quarter of the data falls in each of those four sections, so the box holds roughly the middle half.

The width of the box is the interquartile range, or IQR. The fences come from it, and they decide where the whiskers stop.

IQR\displaystyle \text{IQR}=Q3−Q1\displaystyle {}= Q_3 - Q_1
lower fence\displaystyle \text{lower fence}=Q1−1.5×IQR\displaystyle {}= Q_1 - 1.5 \times \text{IQR}
upper fence\displaystyle \text{upper fence}=Q3+1.5×IQR\displaystyle {}= Q_3 + 1.5 \times \text{IQR}

Those are the inner fences. The outer fences use 3 in place of 1.5. A value between the inner and outer fences is a mild outlier. A value past an outer fence is an extreme outlier. Each whisker ends at the last real value inside its inner fence, never at the fence itself.

To compare groups, put each one on its own line with a label and a colon, such as "Class A: 70, 75, 80". Every box then shares one axis, and you can read differences in center and spread directly.

Two skew figures sit in the summary. Pearson's second coefficient uses the mean, median and standard deviation, and Bowley's uses only the quartiles, so outliers cannot move it.

Pearson skew\displaystyle \text{Pearson skew}=3(mean−median)s\displaystyle {}= \frac{3(\text{mean} - \text{median})}{s}
Bowley skew\displaystyle \text{Bowley skew}=Q3+Q1−2×medianIQR\displaystyle {}= \frac{Q_3 + Q_1 - 2 \times \text{median}}{\text{IQR}}

Worked examples

Sam logs 13 commutes

Sam's trips take 10, 12, 14, 15, 15, 16, 17, 18, 19, 20, 21, 55, 80 minutes. The median is 17, with Q1 at 14.5 and Q3 at 20.5, so the IQR is 6.

upper fence\displaystyle \text{upper fence}=20.5+1.5×6\displaystyle {}= 20.5 + 1.5 \times 6=29.5\displaystyle {}= 29.5
outer fence\displaystyle \text{outer fence}=20.5+3×6\displaystyle {}= 20.5 + 3 \times 6=38.5\displaystyle {}= 38.5

Both long trips, 55 and 80 minutes, pass the outer fence, so they are extreme outliers. The upper whisker stops at 21, the longest ordinary trip.

The two trips pull the mean up to 24 minutes, above the median. Without them, the mean falls to 16.091 and the median to 16. The median moved far less, so it is the better figure for a typical trip here.

Open this example in the tool

Mr. Lin compares two classes

Class A has a median of 78 and an IQR of 25. Class B has a median of 72.5 and an IQR of 8. Class A scores higher in the middle, yet its box is 3.125 times as wide, so its results vary far more.

Class B's top score of 98 passes its upper fence of 88 and shows as a mild outlier. Class A has no flagged scores, though its range of 60 is much larger than Class B's 38. Its fences are simply wider, because its box is wider.

Open this example in the tool

Ana looks at team pay

Twelve salaries give a five-number summary of $35,000, $43,500, $51,000, $62,500 and $120,000. The upper fence is $91,000, and the outer fence is $119,500, so the top salary is an extreme outlier by a small margin.

That one salary lifts the mean to $57,250, against a median of $51,000. Without it, the mean is $51,545. If Ana wants a "typical salary", the median is the honest number to report.

Open this example in the tool

Reading your result

Read the box before the whiskers. The box covers about half of your values, so a narrow box means a consistent group. Whisker length depends on a few values at the ends and changes more easily.

Use the median's place in the box as a hint. If it sits nearer the bottom of the box, the upper half is more spread out, which suggests a tail of high values. The commute data's Bowley skew of 0.167 points that way. It is a hint and no more, as a small sample can look lopsided by chance.

Treat a flagged value as a question. Fences only say a value is far from the rest. NIST describes box plots as a way to identify outliers, and it is still your call whether one is an error or a real, important result.

Remember what a box cannot show. Two clusters of values can produce the same box as one smooth hump. With fewer than about ten values, one change can move a quartile a long way. A histogram shows the shape a box plot leaves out.

Common mistakes

  • Mixing quartile rules. On 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, the median-of-halves and exclusive methods both give an IQR of 28, but the inclusive method gives 17. Fences move with the IQR, so a value can be flagged under one rule and not another.
  • Drawing the whisker to the fence. The fence is a calculated limit and may match no value at all. The whisker must end on a value you actually have.
  • Calling every long whisker an outlier. A long whisker that stays inside its fence is just spread.
  • Comparing plots on different scales. Two boxes drawn on separate axes can look alike when they are not. Put the groups in one chart.

Questions people ask

Different programs use different rules. Excel's QUARTILE.INC gives 3.5 as Q1 of 1, 2, 4, 7, 8, 9, 10, 12, by interpolating between values. TI graphing calculators split the data at the median and take the median of each half. Choose the matching method to reproduce your software.

Sources