Skip to content

Commit

Permalink
Merge pull request #2441 from rcomer/spines-callback
Browse files Browse the repository at this point in the history
FIX: `_trigger_patch_reclip` takes axes instance
  • Loading branch information
dopplershift authored Sep 25, 2024
2 parents 763abec + 2b09850 commit 694efcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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()

0 comments on commit 694efcf

Please sign in to comment.