[BUG]: `layout.uirevision` doesn't play well with map subplot auto-fit
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
Description
When a map subplot uses fitbounds, layout.uirevision fails to preserve the user's subsequent pan/zoom across Plotly.react calls. The map snaps back to the auto-fit view even when the uirevision value is unchanged.
Screenshots/Video
https://github.com/user-attachments/assets/48f4da34-d74f-4958-a874-2bd9a3844181
Steps to reproduce
- Be on v4.0 (or the default branch after it gets released)
- Plot a
scattermapwithuirevisionset and no explicitcenter/zoom:Plotly.newPlot(gd, [{ type: 'scattermap', lon: [-75, -74, -73], lat: [40, 41, 42], mode: 'markers' }], { uirevision: 'v1', width: 400, height: 400 }); - Pan the map with the mouse
- Call
Plotly.reactwith the sameuirevision:Plotly.react(gd, gd.data, { uirevision: 'v1', width: 400, height: 400 }); - Note that the map snaps back to the auto-fit view instead of keeping the panned view
Notes
- Discovered while working on #7884. The auto-fit and zoom-button behaviors landed there; this uirevision integration was deferred as out-of-scope.
- This works correctly for cartesian axes (via
autorange) and for map subplots when the user has supplied an explicitcenter/zoomfrom the start. It only fails on the auto-fit path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the scattermap case with unchanged layout.uirevision, then trace the map subplot auto-fit path during Plotly.react. Compare it with the existing explicit center/zoom behavior and the cartesian autorange behavior. Done means a user's pan or zoom is preserved across Plotly.react calls when uirevision is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100