Skip to content

Fix shared GeoAxes zoom not propagating to sibling subplots#2652

Merged
greglucas merged 1 commit intoSciTools:mainfrom
guillermodotn:fix/shared-axes-zoom
Apr 9, 2026
Merged

Fix shared GeoAxes zoom not propagating to sibling subplots#2652
greglucas merged 1 commit intoSciTools:mainfrom
guillermodotn:fix/shared-axes-zoom

Conversation

@guillermodotn
Copy link
Copy Markdown
Contributor

Rationale

When using sharex/sharey on cartopy GeoAxes, interactive zoom does not propagate to sibling subplots after adding features. _draw_preprocess() calls autoscale_view() on every draw, resetting all shared limits to full extent. _get_extent_geom() compounds this by calling autoscale_view() inside hold_limits(), which propagates resets to siblings but only restores the current axes.

issue_fix

Closes #2637

Implications

  • _draw_preprocess(): clear ignore_existing_data_limits after the first autoscale_view(), matching matplotlib's own pattern.
  • _get_extent_geom(): read viewLim directly instead of calling autoscale_view(). A dataLim fallback handles the pre-draw case.
  • No test added.

Copy link
Copy Markdown
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this?

I think you should be able to set_xlim/ylim on one axis and ensure that it updates the limits as you expect on the other one in your shared examples.

@guillermodotn guillermodotn force-pushed the fix/shared-axes-zoom branch 3 times, most recently from 99dab89 to 1457061 Compare April 4, 2026 17:08
@guillermodotn guillermodotn requested a review from greglucas April 4, 2026 17:30
@guillermodotn guillermodotn force-pushed the fix/shared-axes-zoom branch from 1457061 to bf40fcd Compare April 7, 2026 15:52
@guillermodotn guillermodotn requested a review from greglucas April 7, 2026 15:55
@greglucas greglucas merged commit f2eef4f into SciTools:main Apr 9, 2026
22 of 23 checks passed
@greglucas
Copy link
Copy Markdown
Contributor

Thanks @guillermodotn!

@QuLogic QuLogic added this to the Next Release milestone Apr 9, 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.

Shared axes not sharing zoom after features are added

3 participants