figure: x axes follow the column structure; split rows keep the right gutter on the last cell only

This commit is contained in:
Martino Ferrari committed 2026-11-04 07:00:52 +01:00
1 parent 69f0083fc0
commit 2cb31cbb91
6 files changed
+366 -53

No files matched your search

+7 -6
View File
@@ -480,10 +480,11 @@ void Renderer::draw(Figure& figure) {
// than laying each row out a second time. Nothing draws before this: a row's
// viewport is the figure's to set.
//
// The figure's one x axis needs no pass of its own: it is the bottom row's own, so
// that row stages it in its own strip through `draw_tick_labels()` like any other
// plot's axis -- and every row above it reserved no x chrome, which is what keeps
// the labels from appearing once per row without a second staging here.
// A shared x axis needs no pass of its own: it is the bottom row's own (of a run of rows
// with the same columns), so that row stages it in its own strip through
// `draw_tick_labels()` like any other plot's axis -- and every row of the run above it
// reserved no x chrome, which is what keeps the labels from appearing once per row without
// a second staging here. A row whose columns differ stages its own.
figure.layout();
for (u32 row = 0; row < rows; ++row) {
Plot& plot = figure.plot(row);
@@ -878,8 +879,8 @@ void Renderer::draw_tick_labels(const Plot& plot, const PlotLayout& layout) {
const f32 line_h = font_backend_.height();
// X labels: unless the plot gave its x label strip away -- a row of a `Figure`
// that reserves no x chrome, because the figure draws one shared axis in the bottom
// row's own strip instead -- in which case it has no strip to put them in and their
// that reserves no x chrome, because the row below has the same columns and draws the
// axis in its own strip instead -- in which case it has no strip to put them in and their
// absence is the point. A plot with no strip would otherwise stage its labels just
// above `axes`' bottom edge, i.e. over its own data. Centred under their tick on the
// strip's single text line, which is the one rule for a plot's labels and a figure's