Fixing minor issues in multifigure plots
CI / debug (tests + all adapters) (push) Canceled after 0s
CI / coverage (floor + measured table) (push) Canceled after 0s
CI / asan (AddressSanitizer) (push) Canceled after 0s

This commit is contained in:
Martino Ferrari committed 2026-10-01 15:32:05 +02:00
1 parent 38ef459897
commit 98cfc5805b
4 files changed
+394 -14

No files matched your search

+15 -1
View File
@@ -126,6 +126,18 @@ class Figure {
void set_row_gap(f32 device_px) noexcept { row_gap_ = device_px > 0.0f ? device_px : 0.0f; }
f32 row_gap() const noexcept { return row_gap_; }
/// A floor under the figure's common left gutter, in device pixels. The gutter
/// `layout()` imposes is the maximum over the rows' *measured* needs, so it follows
/// the tick labels: a `TickFormat::Si` axis whose range moves from `1.5` to `150` to
/// `1.5k` changes the width of its labels, and with it `axes.x` and `axes.w` of every
/// row. A caller that needs a layout which does not depend on content reserves the
/// widest label its formatter can produce once, through this, and the figure takes the
/// larger of the two. Negative values are clamped to 0 (the default: measure only).
void set_min_y_gutter(f32 device_px) noexcept {
min_y_gutter_ = device_px > 0.0f ? device_px : 0.0f;
}
f32 min_y_gutter() const noexcept { return min_y_gutter_; }
/// Whether the shared x axis is the figure's: every row reserves no x label strip
/// and one shared axis is drawn under the last row (the default), or every row
/// draws its own labels and the figure draws nothing extra.
@@ -143,7 +155,8 @@ class Figure {
/// It is also the one place the rows' left chrome can be made to agree (spec §16):
/// each row is laid out once to learn the gutter its own labels and title column
/// need, the figure takes the maximum and imposes it on every row through
/// `Plot::set_min_y_gutter()` before laying the rows out once more -- so every row's
/// `Plot::set_min_y_gutter()` -- never below `set_min_y_gutter()`'s own floor -- before
/// laying the rows out once more, so every row's
/// `axes.x` and `axes.w` are equal and a vertical feature lands in the same pixel
/// column in each. Two passes per row per call, not a loop: the gutter is a maximum
/// over rows and a row's own strip width does not depend on it.
@@ -312,6 +325,7 @@ class Figure {
std::vector<XLink> links_;
FigureLayout layout_{};
f32 row_gap_ = 0.0f;
f32 min_y_gutter_ = 0.0f;
bool labels_bottom_only_ = true;
};