FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: make unused spines invisible by jklymak · Pull Request #12241 · matplotlib/matplotlib · GitHub

Repository navigation

FIX: make unused spines invisible - #12241

Merged
WeatherGod merged 1 commit into
matplotlib:masterfrom
jklymak:fix-mplot3d-spines-invisible
Oct 13, 2018
Merged

WeatherGod merged 1 commit into
matplotlib:masterfrom
jklymak:fix-mplot3d-spines-invisible

Conversation

jklymak commented Sep 23, 2018

Copy link
Copy Markdown
Member

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

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

jklymak added this to the v3.0.x milestone Sep 23, 2018
jklymak added topic: mplot3d topic: geometry manager LayoutEngine, Constrained layout, Tight layout labels Sep 23, 2018
jklymak force-pushed the fix-mplot3d-spines-invisible branch from bc21411 to 57e2133 Compare September 24, 2018 00:05
Comment thread lib/matplotlib/axes/_base.py Outdated
self.stale = True
for k in self.spines.keys():
self.spines[k].set_visible(False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

to be pedantic, this should be done prior to setting the stale flag to True.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ooops. I meant to remove that anyhow..

dopplershift left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems reasonable to me. I'd like @WeatherGod to click the green button, though.

jklymak commented Sep 24, 2018

Copy link
Copy Markdown
Member Author

I'll admit I'm a little unclear what ax.set_axisoff is supposed to do versus the spines being marked not visible. It's possible that the proper fix is in axes/_base.py but I hesitated because ax.set_axisoff would wipe out any user customization of the spine visibility.

The other possible fix is for ax.get_tightbbox to check if axison, and pull any spines out of the artist tree if its off. But that seems fiddly.

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 axis, and then axis could return the correct bbox.

jklymak added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Oct 3, 2018

jklymak commented Oct 9, 2018

Copy link
Copy Markdown
Member Author

ping @WeatherGod if you have a minute

Copy link
Copy Markdown
Member

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?

WeatherGod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yeah, this makes sense in general, just concerned about computation costs.

jklymak force-pushed the fix-mplot3d-spines-invisible branch from 9cbed9e to 74849b9 Compare October 10, 2018 02:31
FIX: remove visible logic from _base.py

FIX: also exclued spines tight layout
jklymak force-pushed the fix-mplot3d-spines-invisible branch from 74849b9 to 0a926aa Compare October 11, 2018 00:21
WeatherGod merged commit b424c85 into matplotlib:master Oct 13, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 13, 2018
QuLogic added a commit that referenced this pull request Oct 14, 2018
…241-on-v3.0.x

Backport PR #12241 on branch v3.0.x (FIX: make unused spines invisible)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: geometry manager LayoutEngine, Constrained layout, Tight layout topic: mplot3d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3d axes are collapsed by tight_layout

4 participants


Back | FazBrowse Home | New Git URL