Skip to content
misoto22 design

Charts

BoxPlot

The spread of a measurement, per category.

When to reach for it

How variable is this, across six things at once. When the shape of ONE distribution is the question it wants a Histogram; when there are few enough observations to draw them all, a ScatterChart.

Examples

default

Response time by regionOne box per edge location, 24 hours
Response time by region
nameMinimumLower quartileMedianUpper quartileMaximumOutliers
Sydney182195.75207219.252361
Singapore244259271.5287.753180
Frankfurt310326.5341358.753791
Oregon268280.25290.5305.753410

orientation

Response time by region
Response time by region
nameMinimumLower quartileMedianUpper quartileMaximumOutliers
ap-southeast-2182195.75207219.252361
ap-southeast-1244259271.5287.753180
eu-central-1310326.5341358.753791
us-west-2268280.25290.5305.753410

notched

Checkout latency by variantNotch width falls with the square root of the sample
Checkout latency by variant
nameMinimumLower quartileMedianUpper quartileMaximumOutliers
Control1802142362623180
Variant A1762082292553100
Variant B1842262582913560

Notes

The spread of a measurement, per category — median, middle half, reach, and the points that sit outside it.

The form to reach for when the question is "how variable is this", and the one that answers it in a tenth of the ink a histogram per category would take. Six response-time distributions fit across one screen as six boxes; as six histograms they do not fit at all.

What a box plot hides is multimodality. A box is five numbers, and five numbers cannot tell a single hump from two. A bimodal distribution — a fast cache path and a slow database path, two cohorts inside one average — draws exactly the same box as a smooth one centred in the same place, and the reader has no way to tell from the picture that the middle of the box is a value almost nothing takes. It also hides sample size: a box over six points and a box over six thousand are drawn identically, which is why count is worth carrying and why a notch, which does read count, is worth turning on when medians are being compared. When the SHAPE of one distribution is the question, reach for <Histogram>; when there are few enough observations to draw them all, reach for <ScatterChart> and plot the points.

Recharts earns its place here: the boxes need a shared value axis with real ticks, a category axis, a grid and a tooltip, which is most of a cartesian chart. What it does not have is a box mark, so each box is drawn as a custom shape over a range bar — the bar supplies the category band and the scale, and the glyph inside it is ours.

Props

BoxPlot props
PropTypeDefaultDescription
childrenrequiredReactNodeThe composed parts — axes, grid, tooltip, and `<BoxPlot.Boxes>`.
datarequiredBoxPlotDatum[]One entry per category, as raw observations or as a summary.
titlerequiredstringWhat the chart shows, in a sentence a reader could act on. Required, and announced to a screen reader even when it is not printed.
chartPropsComponentProps<typeof RechartsBarChart>Escape hatch onto the raw Recharts chart element.
classNamestringMerged onto the figure, last, so a call site can size or space it.
configChartConfigDEFAULT_CONFIGThe single series — its label and its paint. Only the FIRST entry is read; a box plot has one measurement and as many categories as it has boxes.
descriptionReactNodeA line under the title — the unit, the window, the caveat.
emptyChartEmptyProps | falseWhat the chart shows when it has nothing to draw. `false` keeps the axes, for a chart whose emptiness is itself the reading.
formatValue(value: number) => stringdefaultTickFormats every number the chart prints — ticks, tooltip, table.
hideDataTablebooleanfalseDrops the hidden table view. Only correct when the page prints the data itself.
orientationBoxPlotOrientation'vertical'Which way the boxes run. Reach for `horizontal` when the category names are long enough to need rotating under a column.
showTitlebooleanPrints the title above the plot instead of hiding it from sight.

Types

TSX
export type BoxPlotOrientation = 'vertical' | 'horizontal'
export type BoxPlotDatum = BoxPlotSample | (BoxPlotSummary & { values?: never })

Accessibility

  • A box is five numbers, and five numbers cannot tell one hump from two. A bimodal distribution draws exactly the same box as a smooth one centred in the same place — the component says so in its own description rather than in a footnote.
  • It also hides sample size: a box over six points and a box over six thousand are drawn identically. Carry count, and turn on notched whenever medians are being compared.
  • Raw values are summarised with Tukey’s fences, which is stated on the page rather than assumed — a different fence rule draws different outliers from the same data.
  • The hidden data table carries all five numbers per category, so the figure is readable without seeing the glyph.