Skip to content

fix(plot): align main axis x-range with user-supplied axes in ratio/pull plots - #700

Open
henryiii wants to merge 1 commit into
mainfrom
fix-plot-ratio-alignment
Open

fix(plot): align main axis x-range with user-supplied axes in ratio/pull plots#700
henryiii wants to merge 1 commit into
mainfrom
fix-plot-ratio-alignment

Conversation

@henryiii

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Closes #659.

In _plot_ratiolike, the main axis was pinned to the bin-edge range only via sharex in the auto-created-subplot branch. When the user supplied their own axes through ax_dict there was no sharex, so the main axis kept matplotlib's autoscaled (5% margin) limits while the subplot was clamped to the edges — the histogram and the ratio/pull points failed to line up. The fix sets main_ax.set_xlim(...) to the bin edges in both branches (the auto branch value is unchanged, so existing --mpl baselines stay valid).

Test: tests/test_plot.py::test_plot_ratio_ax_dict_alignment (parametrized int/reg) asserts main/subplot xlim agree and the with/without-ax_dict cases match — numeric only, no image comparison.

Left for review: the separate question of ratio markers at left-edge vs center for Regular axes (#637/#655) is consistent across both branches here, so it's out of scope for this inconsistency fix.

The main axis was only pinned to the bin edges via sharex in the
auto-subplot branch, so user-supplied ax_dict axes kept autoscaled
limits and misaligned with the ratio/pull subplot. Set the main xlim
explicitly in both branches. Closes #659.

Assisted-by: ClaudeCode:claude-opus-4.8
@henryiii
henryiii force-pushed the fix-plot-ratio-alignment branch from da50693 to 139c10b Compare June 25, 2026 20:22
@henryiii
henryiii marked this pull request as ready for review June 25, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Binning alignment differences between int/regular and own subplots/on the fly

1 participant