React Box Plot

Two tools with the same mean and very different spread look identical on a bar chart. Here they look obviously different — which is the entire reason to plot a distribution rather than its average.

Etch depth by tool

4 groups · box = Q1–Q3, whiskers = 1.5×IQR

240244249254258USLLSLETCH-1n=60ETCH-2n=60ETCH-3n=62ETCH-4n=60

MEDIAN

Q1

Q3

IQR

Lower whisker

Upper whisker

Hover a group for its five-number summary.

Installation

npx shadcn@latest add "https://kelvinui.com/registry/box-plot.json"

Props

PropTypeDescription
groupsBoxGroup[]{ label, values, color? }
unitstringAppended to the readout
showPointsbooleanDraw raw samples behind each box (default true)
usl lslnumberSpec limits across all groups
heightnumberSVG height (default 300)

The exported computeBox(values) returns the full five-number summary plus iqr, outliers, and n, so you can reuse the statistics outside the chart.

ReturnedMeaning
q1 median q3Linear-interpolation percentiles
lowerWhisker upperWhiskerFurthest sample inside the 1.5×IQR fence
outliersSamples beyond the fence

Percentiles that match your other tools

Quartiles use linear interpolation — the "type 7" definition that NumPy and R use by default. That matters more than it sounds: there are at least nine published quartile definitions, and picking a different one gives you a box that disagrees with the analysis your process engineers ran in Python. Verified against the reference: [1..10] yields Q1 3.25, median 5.5, Q3 7.75, exactly as numpy.percentile(..., method="linear") does.

Whiskers are Tukey fences: they extend to the furthest actual sample still within 1.5×IQR of the box, not to a fixed percentile and not to the extremes. Anything beyond is drawn as a hollow outlier ring. That distinction is the point of the chart — a whisker that always reached the min and max would tell you nothing about whether a value is unusual.

Raw samples are jittered behind each box using a deterministic hash of the index, never Math.random(), so the cloud is identical between the server render and the browser.

New components every week

Get the week's new Kelvin UI components and templates in one short email. No spam, unsubscribe anytime.