Skip to content

Box plot

A box plot answers “how does this distribution differ across categories?” Each box shows the median, the inter-quartile range (Q1–Q3), the whiskers (1.5×IQR), and individual outliers.

```plot view=order_amounts_by_segment
Plot.boxY(data, { x: "segment", y: "amount" })
```
```plot view=order_amounts_by_region
Plot.boxX(data, { x: "amount", y: "region" })
```
OptionMeaning
x, yone categorical (the box axis), one numeric (the value axis)
fillcolumn name → box color (often the same as the categorical axis)
strokecolumn name → median line / whisker color
rradius of outlier dots
tiptrue for hover tooltips

A box plot is a composite mark — under the hood it’s a bar (the box) + a tick (the median) + rules (the whiskers) + dots (the outliers). The mark’s options forward to the appropriate child.

See Observable Plot — box for the full reference.