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.
Vertical boxes (categories on x)
Section titled “Vertical boxes (categories on x)”```plot view=order_amounts_by_segmentPlot.boxY(data, { x: "segment", y: "amount" })```Horizontal boxes (long category labels)
Section titled “Horizontal boxes (long category labels)”```plot view=order_amounts_by_regionPlot.boxX(data, { x: "amount", y: "region" })```Common options
Section titled “Common options”| Option | Meaning |
|---|---|
x, y | one categorical (the box axis), one numeric (the value axis) |
fill | column name → box color (often the same as the categorical axis) |
stroke | column name → median line / whisker color |
r | radius of outlier dots |
tip | true 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.