@@ -2820,22 +2820,13 @@ def get_default_bbox_extra_artists(self):
28202820 # or use the axes bounding box or patch path for clipping.
28212821 # NOTE: Critical to ignore x and y axis, spines, and all child axes.
28222822 # For some reason these have clipping 'enabled' but it is not respected.
2823- # NOTE: Native transforms and bounding boxes have no equality tests
2824- # so have to do this manually (inspired by Affine2D equality tests).
2825- # Matplotlib almost always uses clip paths rather than boxes, which copies
2826- # the background patch CompositeGenericTransform as a hidden property on
2827- # TransformedPatchPath, from which the Affine2D transform is built.
2828- # Try to avoid using private '_patch' and '_transform' attributes.
2823+ # NOTE: Matplotlib already tries to do this inside get_tightbbox() but
2824+ # their approach fails for cartopy axes clipped by paths and not boxes.
28292825 artists = [
28302826 artist for artist in super ().get_default_bbox_extra_artists ()
28312827 if isinstance (artist , (maxes .Axes , maxis .Axis , mspines .Spine ))
2832- or not artist .get_clip_on ()
2833- or artist .get_clip_box () is not None and not np .all (
2834- np .array (artist .get_clip_box ()) == np .array (self .bbox )
2835- )
2836- or artist .get_clip_path () is not None and not np .all (
2837- np .array (artist .get_clip_path ()) == np .array (self .patch .get_transform ())
2838- )
2828+ or not isinstance (artist .get_clip_path (), mtransforms .TransformedPatchPath )
2829+ or artist .get_clip_path ()._patch is not self .patch
28392830 ]
28402831 return artists
28412832
0 commit comments