From bb3627f9549130b3e0f1107b70f3f185046aa135 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 14 Oct 2026 13:53:06 -0400 Subject: [PATCH] Fix up merged PRs: minor gridlines on a logarithmic axis #666's minor gridlines stepped in value units, but #669 scales a log axis in exponents of its base; map each minor step back through the base. Co-Authored-By: Claude Opus 5.5 --- crates/render/src/chart.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/render/src/chart.rs b/crates/render/src/chart.rs index 54d989f8..c6f35fdc 100644 --- a/crates/render/src/chart.rs +++ b/crates/render/src/chart.rs @@ -411,7 +411,9 @@ fn draw_inner(ctx: &mut RenderContext, rctx: &Ctx, c: &Chart, m: Affine, w: f64, let n = (((max - min) / minor.max(1e-12)).round() as i64).clamp(1, 500); let mut g = BezPath::new(); for k in (0..=n).filter(|k| k % 5 != 0) { - let pos = to_v(min + k as f64 * minor); + // On a logarithmic axis `min`, `max` and `step` are exponents of the base. + let e = min + k as f64 * minor; + let pos = to_v(log.map_or(e, |(b, _)| b.powf(e))); if horiz { g.move_to((pos, plot.y0)); g.line_to((pos, plot.y1));