@graphysdk/geom-error-bar
Beta. This geom is on a
0.xversion line: a minor release may change its aesthetics, params, style or look. Use a caret range (^0.1.0) to take only patches.
An error bar geom for the Graphy charting SDK. It draws the uncertainty around an estimate as a line from the interval's lower end to its upper, with a cap across each end, over the bars or points that show the estimates.
Learn more at graphy.dev.
Install
npm install @graphysdk/geom-error-bar @graphysdk/react
Requires React 19. Its only peer is @graphysdk/react.
Usage
Data is one row per estimate. Map the category to x and the estimate to y. Map the interval as lower and upper, or as an error either side of y. Draw it after the bars so it paints on top; a colour group dodges each error bar onto its own bar:
import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
import { errorbar } from '@graphysdk/geom-error-bar';
const kit = createGraphyKit({ plugins: [errorbar] });
const spec = kit.pipe(
kit.createSpec({ x: 'treatment', y: 'days', color: 'age' }),
kit.geom.bar(),
kit.geom.errorbar({ aes: { lower: 'ciLow', upper: 'ciHigh' } }),
kit.scale.x.discrete(),
kit.scale.y.continuous()
);
export function Recovery({ data }) {
return (
<kit.GraphProvider spec={spec} data={data}>
<GraphRenderer />
</kit.GraphProvider>
);
}
kit.geom.errorbar({ aes: { error: 'se' } }) reaches the error either side of y instead. params: { width } sets how much of its band share each cap spans (0.5 by default, 0 for none).
Style the line and caps with kit.style.geom.errorbar().
Docs
Feedback
This geom is released early to hear what works. Tell us on Discord.
Licence
This package is available under PolyForm Noncommercial, Small Business, or a 32-day Free Trial. Free Trial is local or internal evaluation only — it does not cover a public page. See what you can do under the trial.
For a commercial licence, talk to us.