Summary
Add error bar rendering to line plots and scatter plots — matching matplotlib's plt.errorbar(). This is essential for any benchmark visualization that needs to show variance, standard deviation, or confidence intervals.
Motivation
When comparing algorithm implementations, the mean alone is misleading. Error bars communicate the spread (e.g., ±1 stddev, min/max, or 95% CI) directly on the plot. Without this, Sepia cannot produce publication-quality performance charts.
Proposed API
std::vector<double> x = {1, 2, 3, 4};
std::vector<double> y = {10.2, 15.7, 9.8, 13.1};
std::vector<double> y_err = {0.5, 1.2, 0.3, 0.8}; // symmetric ±
// Or asymmetric:
std::vector<double> y_lo = {0.4, 0.9, 0.2, 0.7};
std::vector<double> y_hi = {0.6, 1.5, 0.4, 0.9};
figure.plot(x.data(), y.data(), 4)
.error_bar(y_err.data()) // symmetric
// or:
.error_bar(y_lo.data(), y_hi.data()) // asymmetric
.color(sepia::Color{60, 140, 255})
.label("mean latency");
Implementation Notes
- Store optional error arrays inside
PlotEntry (nullable pointers + ownership flag)
- During
render_data() in figure.hpp, after drawing the main line/markers, iterate points and draw vertical cap-lines: a vertical segment of height 2*err centered on the point, plus horizontal caps of fixed pixel width (e.g., 4px)
- X error bars follow the same pattern horizontally
- Cap width should be a style parameter (default: 4px)
CoordTransform already handles the data→pixel mapping needed
Acceptance Criteria
Summary
Add error bar rendering to line plots and scatter plots — matching matplotlib's
plt.errorbar(). This is essential for any benchmark visualization that needs to show variance, standard deviation, or confidence intervals.Motivation
When comparing algorithm implementations, the mean alone is misleading. Error bars communicate the spread (e.g., ±1 stddev, min/max, or 95% CI) directly on the plot. Without this, Sepia cannot produce publication-quality performance charts.
Proposed API
Implementation Notes
PlotEntry(nullable pointers + ownership flag)render_data()infigure.hpp, after drawing the main line/markers, iterate points and draw vertical cap-lines: a vertical segment of height2*errcentered on the point, plus horizontal caps of fixed pixel width (e.g., 4px)CoordTransformalready handles the data→pixel mapping neededAcceptance Criteria
plot()andscatter()seriesexamples/error_bars.cpp