Repository navigation
Conversation
`hasRange` was never reset between match groups, so once a group with an explicit range was processed, every later group without `autorange` got `autorange: false` and fell back to the default range. With shared x and y axes on a grid and a range set on the x axes, the y axes stopped autoranging. The explicit-range check also read `axIn` after the loop, which is the last axis visited rather than the axis the range came from. Check it where the value is picked instead. Fixes plotly#8053
KoolADE85
self-requested a review
November 9, 2026 20:48
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.
Fixes #8053.
Problem
With
make_subplots(rows=2, cols=2, shared_xaxes=True, shared_yaxes=True)and a range set on the x axes, the y axes stop autoranging and show[-1, 4]. The layout from the issue boils down to four match groups,{x, x3}and{x2, x4}with a range, then{y, y2}and{y3, y4}without one:Cause
In
constraints.handleDefaults,hasRangeis declared once, before the loop over match groups, and never reset. After the first x group sets it, every later group with no explicitautorangegetsautorange: false. The y axes then have no range and fall back to the default one. It needs at least two match groups, which is why the issue only shows up with more than one row and more than one column.Resetting
hasRangefor each group exposed a second problem, caught by the existingshould match set axis range value for matching axestest. The explicit-range check ran after the loop and readaxIn, which is the last axis visited, not the axis the range came from. For the{x3, y3}group in that test, the range comes fromyaxis3, but the loop ends onxaxis3, which has none. The test only passed becausehasRangeleaked in from the{y, y2}group processed before it.Changes
hasRangeat the start of each match group.hasRangeinsetAttrVal, from the input of the axis that supplies the range, with the same validity check as before.Tests
New
axes_test.jscase using the layout above: the x axes keepautorange: falseand the y axes getautorange: true. It fails onmain(Expected false to be true, 'yaxis', same foryaxis2-yaxis4).Locally (Windows 11, Chrome 156):
axes_test.js: 407 passed, 2 failed. The 2 failures (insiderange relayout,insiderange react to new data) also fail onmainhere, off by a few pixels.cartesian_test.js,cartesian_interact_test.js,splom_test.js,range_slider_test.js,plot_api_react_test.js: the same 12 drag, map and WebGL tests fail with and without this change, and the rest pass.biome lintpasses on the changed files.I didn't run the image baseline tests.