Skip to main content
v2026.11,858 entries · CC-BY 4.0

Box and Whisker Plot Comparison: How to Read Box Plots

How to compare box and whisker plots: medians, spread, outliers and notches, with a computed two-group example and Excel, R and Python code.

Written and maintained by CASRAI Editorial Board

Last updated

A box and whisker plot comparison puts two or more box plots on one axis so you can judge differences in location (the median) and spread (the box and whiskers) between groups at a glance. NIST’s Engineering Statistics Handbook describes the box plot as “an excellent tool for conveying location and variation information in data sets” and notes that multiple box plots “can be drawn together to compare multiple data sets or to compare groups in a single data set.” This guide shows how to read a side-by-side comparison, with a fully computed two-group example, a reading table, a reporting template and code for Excel, R and Python.

What is a box and whisker plot?

A box and whisker plot (also called a box plot or box-whisker plot) is a chart built from five numbers: the minimum, the first quartile (Q1), the median, the third quartile (Q3) and the maximum. The box runs from Q1 to Q3, so it holds the middle 50% of the data, which NIST calls the “body” of the data. A line or symbol inside the box marks the median. The whiskers extend outward from the box. For the full quartile mechanics see the five-number summary and interquartile range guide; for the chart types it sits beside, see types of graphs in statistics.

How to make a box whisker plot for several groups

To compare groups, draw one box per group on a shared vertical axis, in a fixed order, with the same axis scale for every box. NIST notes that box widths may be proportional to group size or all equal; say which you used. The steps for each group are:

  1. Sort the values and find the median, Q1 and Q3. The interquartile range is IQR = Q3 − Q1.
  2. If you use fences, compute the lower fence L1 = Q1 − 1.5 × IQR and the upper fence U1 = Q3 + 1.5 × IQR. In NIST’s definition the lower whisker runs to the smallest data point greater than L1 and the upper whisker to the largest point below U1. Points beyond the fences are drawn individually as outliers. Without fences, the whiskers simply run to the minimum and maximum.
  3. Draw the box, the median line, the whiskers and any outlier points for each group, side by side.

Symbols: Q1 and Q3 are the 25th and 75th percentiles, IQR is the box length, and 1.5 is the conventional multiplier (R’s coef argument controls it; setting it to 0 sends the whiskers to the extremes and plots no outliers).

Worked example: how to compare two box plots

Two groups of nine measurements each (illustrative numbers, not real study data). With n = 9, the common quartile methods agree: Q1 is the 3rd sorted value and Q3 is the 7th.

Statistic Group A Group B
Sorted data 12, 14, 15, 16, 18, 20, 21, 23, 40 18, 21, 23, 25, 27, 29, 31, 34, 36
Median (5th value) 18 27
Q1 / Q3 15 / 21 23 / 31
IQR = Q3 − Q1 6 8
Lower fence: Q1 − 1.5 × IQR 15 − 9 = 6 23 − 12 = 11
Upper fence: Q3 + 1.5 × IQR 21 + 9 = 30 31 + 12 = 43
Whisker ends 12 and 23 18 and 36
Outliers 40 (above 30) none
Notch: median ± 1.58 × IQR / √n 18 ± 3.16 = 14.84 to 21.16 27 ± 4.21 = 22.79 to 31.21

The notch arithmetic for Group A is 1.58 × 6 / √9 = 9.48 / 3 = 3.16; for Group B it is 1.58 × 8 / 3 = 4.21. Reading the pair: Group B’s median is 9 units higher (27 versus 18); Group B’s box is slightly longer (IQR 8 versus 6); Group A has one high outlier (40) that would stretch a min-to-max range but not the box; and the notch intervals (up to 21.16 versus from 22.79) do not overlap.

What do overlapping boxes mean?

Overlapping boxes mean the middle halves of the two groups share values; a gap between boxes is not a formal test either way. In the example the boxes do not overlap (A’s Q3 is 21, B’s Q1 is 23), but with larger or noisier data they often do. Use the notches as a more specific guide: R’s documentation says notches extend to ±1.58 IQR / √n, and the idea is to give roughly a 95% confidence interval for the difference in two medians, so non-overlap is rough evidence of a difference, not a test.

Interpretation: reading guide for side-by-side box plots

What you see What it indicates
Median lines at different heights The groups differ in location (typical value).
One box longer than the other The longer box has the larger IQR, so more spread in its middle 50%.
Notches do not overlap Rough evidence that the medians differ (R documentation); confirm with a test.
Individual points beyond the whiskers Values outside the 1.5 × IQR fences; check them against how to find an outlier in statistics.
Median off-centre in the box, uneven whiskers Asymmetry in that group; see reading a right-skewed box plot.

Assumptions and common mistakes

  • Different quartile methods. R’s documentation explains that “hinges” are versions of the quartiles: equal to the quartiles when n is odd, and between observations when n is even. Software that uses different quartile methods can therefore draw slightly different boxes from the same even-sized data set. State the method you used.
  • Different axes. Compare boxes only on one shared axis scale.
  • Treating notches as a test. Non-overlap is approximate evidence only.
  • Ignoring group size. A box does not display n; report it beside the plot or scale box widths by group size.
  • Whisker definition left unstated. State whether whiskers are fence-based (1.5 × IQR) or run to min and max.

How to report a box plot comparison (APA-style template)

Report the summary statistics the plot shows, then the inferential test. A template for the example: “Group A (Mdn = 18, IQR = 6, n = 9) had a lower median than Group B (Mdn = 27, IQR = 8, n = 9); a Mann–Whitney U test gave U = 14.5, p = [value from your software].” Here U is the number of (Group A, Group B) pairs in which the Group A value is larger, with ties counted as 0.5. Counting, for each sorted Group A value, the Group B values below it gives U = 0 + 0 + 0 + 0 + 0.5 + 1 + 1.5 + 2.5 + 9 = 14.5. Check the test’s requirements in Mann-Whitney U test assumptions. In the figure caption, state the whisker rule, the quartile method and n per group.

How to calculate and plot it in Excel, R or Python

Excel

For each group in its own column (A2:A10 and B2:B10), use =QUARTILE.INC(A2:A10,1), =MEDIAN(A2:A10) and =QUARTILE.INC(A2:A10,3). For the example this returns 15, 18 and 21. For the chart, select both columns and use Insert > Insert Statistic Chart > Box and Whisker. The chart’s format options let you choose an inclusive or exclusive median for the quartile calculation; with an odd n such as 9, the exclusive option leaves the median out of the quartile calculation, so its quartiles can differ from the QUARTILE.INC values above. Pick the option that matches the method you report.

R

a <- c(12,14,15,16,18,20,21,23,40)
b <- c(18,21,23,25,27,29,31,34,36)
boxplot(a, b, names = c("A","B"), notch = TRUE)
fivenum(a); fivenum(b)       # Tukey hinges
boxplot.stats(a)$out         # 40

For a fuller walk-through see box plots in R.

Python

import numpy as np
import matplotlib.pyplot as plt
a = [12,14,15,16,18,20,21,23,40]
b = [18,21,23,25,27,29,31,34,36]
print(np.percentile(a, [25, 50, 75]))   # [15. 18. 21.]
print(np.percentile(b, [25, 50, 75]))   # [23. 27. 31.]
plt.boxplot([a, b])
plt.xticks([1, 2], ["A", "B"])
plt.show()

SPSS users can follow box plots in SPSS.

FAQ

What is box and whisker plot?

A chart of the five-number summary: a box from Q1 to Q3 with a median line, and whiskers reaching toward the minimum and maximum.

What is box whisker plot or box and whiskers plot?

Both are other names for the same chart, usually shortened to box plot.

What is plot box?

People usually mean the box plot. Its box is the Q1-to-Q3 range, which holds the middle 50% of the data.

How to create a box and whisker plot?

Find the five-number summary, compute the fences if you want outliers shown, then draw the box, median, whiskers and outlier points on one axis. The steps are above, with code for Excel, R and Python.

How to compare two box plots?

Compare medians first, then box length (IQR), then whisker length and outliers, then notch overlap, all on a shared axis. Confirm any difference with a named statistical test.

Sources

All sources checked 2026-10-29.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Box and Whisker Plot Comparison: How to Read Box Plots

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.