Summary
Add a dedicated scatter() API to Figure that plots unconnected data points, matching matplotlib's plt.scatter() behavior.
Motivation
Scatter plots are the most common way to visualize raw performance samples — e.g., latency vs. throughput across different implementations. Currently users have to abuse plot() with line_style = LineStyle::None manually every time.
Proposed API
figure.scatter(x.data(), y.data(), n)
.color(sepia::Color{255, 80, 80})
.marker(sepia::MarkerStyle::Circle, 4.0)
.label("impl A");
A scatter() call should default to:
line_style = LineStyle::None
marker = MarkerStyle::Circle
marker_size = 4.0
It should otherwise reuse PlotCommand and PlotEntry unchanged.
Implementation Notes
- Add
Figure::scatter(const double*, const double*, std::size_t) overload in include/sepia/plot2d/figure.hpp
- Add a corresponding
scatter(Series&&) and scatter_ref(...) overload for API symmetry with plot()
- The implementation is ~5 lines: construct a
PlotCommand with the two defaults pre-set
- No changes needed to the rendering pipeline
Acceptance Criteria
Summary
Add a dedicated
scatter()API toFigurethat plots unconnected data points, matching matplotlib'splt.scatter()behavior.Motivation
Scatter plots are the most common way to visualize raw performance samples — e.g., latency vs. throughput across different implementations. Currently users have to abuse
plot()withline_style = LineStyle::Nonemanually every time.Proposed API
figure.scatter(x.data(), y.data(), n) .color(sepia::Color{255, 80, 80}) .marker(sepia::MarkerStyle::Circle, 4.0) .label("impl A");A
scatter()call should default to:line_style = LineStyle::Nonemarker = MarkerStyle::Circlemarker_size = 4.0It should otherwise reuse
PlotCommandandPlotEntryunchanged.Implementation Notes
Figure::scatter(const double*, const double*, std::size_t)overload ininclude/sepia/plot2d/figure.hppscatter(Series&&)andscatter_ref(...)overload for API symmetry withplot()PlotCommandwith the two defaults pre-setAcceptance Criteria
scatter()compiles and renders correctlyscatter,scatter(Series&&),scatter_ref)examples/scatter.cpp