Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: _trigger_patch_reclip takes axes instance #2441

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/cartopy/mpl/geoaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2302,13 +2302,12 @@ def add_wms(self, wms, layers, wms_kwargs=None, **kwargs):
GeoAxesSubplot.__module__ = GeoAxes.__module__


def _trigger_patch_reclip(event):
def _trigger_patch_reclip(axes):
"""
Define an event callback for a GeoAxes which forces the background patch to
be re-clipped next time it is drawn.

"""
axes = event.axes
# trigger the outline and background patches to be re-clipped
axes.spines['geo'].stale = True
axes.patch.stale = True
6 changes: 6 additions & 0 deletions lib/cartopy/tests/mpl/test_mpl_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,3 +1071,9 @@ def test_annotate():
)

return fig


def test_inset_axes():
fig, ax = plt.subplots()
ax.inset_axes([0.75, 0.75, 0.25, 0.25], projection=ccrs.PlateCarree())
fig.draw_without_rendering()