Skip to content

Keep autorange on matched axes when only another match group sets a range - #8092

Open
sap1110 wants to merge 2 commits into
plotly:mainfrom
sap1110:fix-8053-matches-autorange
Open

sap1110 wants to merge 2 commits into
plotly:mainfrom
sap1110:fix-8053-matches-autorange

Conversation

@sap1110

@sap1110 sap1110 commented Sep 29, 2026

Copy link
Copy Markdown

Fix axis defaults so that a set range in one match group no longer turns off autorange in other match groups.

Fixes #8053

In constraints.js, the hasRange flag was initialized once for all match groups. After one group with an explicit range, each later group without a range got autorange: false, and its axes fell back to [-1, 4]. A 2x2 grid with shared x and y axes and a set x range shows the problem. The fix resets the flag for each group. The fix also reads the range from the axis that supplied the value. Before, the check read axIn, which holds the last axis of the loop and can be a different axis. The existing test "should match set axis range value for matching axes" relied on the stale flag for the {x3, y3} group, and it passes with the corrected check.

Tests: new case in axes_test.js. The axes, cartesian, and plot_api suites pass locally, except for 2 axes tests (tickson ... rotate labels, insiderange react to new data) that also fail on main on my machine.

The match group defaults kept the hasRange flag across groups. After one
group with a set range, every later group without a range got autorange
false, and its axes fell back to the default [-1, 4] range. A 2x2 grid
with shared x and y axes and a set x range shows the problem.

Reset the flag for each group. Read the range from the axis that
supplied the value, because the loop variable holds the last axis of the
group, which can differ from the axis with the range.

Fixes plotly#8053
@camdecoster

Copy link
Copy Markdown
Contributor

Thanks for the PR! Our team will take a look and follow up.

@camdecoster camdecoster self-assigned this Sep 29, 2026
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]: Y-axis autorange stops working when updating the xaxes range for subplots with shared x-axes and y-axes

2 participants