Skip to content

[BUG]: layout.uirevision doesn't play well with map subplot auto-fit #7907

Description

@camdecoster

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

Screencast.From.2026-07-15.17-06-21.mp4

Steps to reproduce

  • Be on v4.0 (or the default branch after it gets released)
  • Plot a scattermap with uirevision set and no explicit center/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.react with the same uirevision:
    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 fix: Dynamically compute default zoom/center for map traces #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 explicit center/zoom from the start. It only fails on the auto-fit path.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions