| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
PR matplotlib#31525 made Axes.__clear call Spine._ensure_transform_is_set on every spine, which calls set_position(('outward', 0.0)) for a spine that still carries the placeholder transform from Spine.__init__. Custom spines such as cartopy's GeoSpine have a non-cartesian spine_type, manage their own transform, and may reject set_position, so this raised NotImplementedError on plain subplot creation. Restrict the spine nudge to the four standard cartesian spine types, the only ones set_position / get_spine_transform support. See SciTools/cartopy#2674. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| if (self.spine_type in ('left', 'right', 'top', 'bottom') | ||
| and self._position is None | ||
| and self._transform is self.axes.transData): | ||
| self.set_position(('outward', 0.0)) |
There was a problem hiding this comment.
I suppose an alternative question would be whether there is a way to do this same idea through a different call mechanism rather than adding these cutouts for the spine types? i.e. using some different function from set_position() to ensure the transform is set.
Sorry, something went wrong.
There was a problem hiding this comment.
The semantics is encapsulated in the method _ensure_transform_is_set(). Therefore special-casing in there is ok. Possibly one could require thagt derived spines must implement set_position or override _ensure_transform_is_set. But it's easy to do this on our side. If you want to improve further, there should be documentation on subclassing spines.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR summary
PR #31525 added a spine-transform nudge in Axes.__clear that calls Spine._ensure_transform_is_set() on every spine. For a spine still carrying the placeholder transform from Spine.__init__, this calls set_position(('outward', 0.0)).
Custom spines with a non-cartesian spine_type — e.g. cartopy's GeoSpine — manage their own transform and may reject set_position(), so this raised NotImplementedError on plain subplot creation (SciTools/cartopy#2674).
The nudge now only fires for the four standard cartesian spine types (left, right, top, bottom), the only ones set_position / get_spine_transform support.
AI Disclosure
Claude code was used in creating a PR.
PR checklist