-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: make unused spines invisible #12241
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: make unused spines invisible #12241
Conversation
bc21411
to
57e2133
Compare
lib/matplotlib/axes/_base.py
Outdated
@@ -2970,6 +2970,9 @@ def set_axis_off(self): | |||
"""Turn off the axis.""" | |||
self.axison = False | |||
self.stale = True | |||
for k in self.spines.keys(): | |||
self.spines[k].set_visible(False) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be pedantic, this should be done prior to setting the stale flag to True.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops. I meant to remove that anyhow..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me. I'd like @WeatherGod to click the green button, though.
I'll admit I'm a little unclear what The other possible fix is for Frankly, I'm not quite sure why the spines are separate artists from the axis objects. It would seem to me they should be children artists of |
ping @WeatherGod if you have a minute |
A long time ago, what appeared as spines used to be a part of the axis (they weren't called that back then), but then we transitioned over to this spines implementation that allowed for all sorts of neat and useful graphs. I think we made them children of axes because it simplified the API that way, but I don't remember for sure. I think the transition was around v1.0 or v1.1? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this makes sense in general, just concerned about computation costs.
9cbed9e
to
74849b9
Compare
FIX: remove visible logic from _base.py FIX: also exclued spines tight layout
74849b9
to
0a926aa
Compare
…241-on-v3.0.x Backport PR #12241 on branch v3.0.x (FIX: make unused spines invisible)
PR Summary
Closes #12239
mplot3d turned axis off but for whatever reason the spines were still created, and were marked as visible, so get_tightbbox included their nonsense extents in its calculations. This change just makes the spines not be visible.
PR Checklist