fix(plot): align main axis x-range with user-supplied axes in ratio/pull plots - #700
Open
henryiii wants to merge 1 commit into
Open
fix(plot): align main axis x-range with user-supplied axes in ratio/pull plots#700henryiii wants to merge 1 commit into
henryiii wants to merge 1 commit into
Conversation
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
force-pushed
the
fix-plot-ratio-alignment
branch
from
June 25, 2026 20:22
da50693 to
139c10b
Compare
henryiii
marked this pull request as ready for review
June 25, 2026 20:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Closes #659.
In
_plot_ratiolike, the main axis was pinned to the bin-edge range only viasharexin the auto-created-subplot branch. When the user supplied their own axes throughax_dictthere was nosharex, 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 setsmain_ax.set_xlim(...)to the bin edges in both branches (the auto branch value is unchanged, so existing--mplbaselines 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_dictcases 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.