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

If text location isn't finite, set it to not visible by dstansby · Pull Request #7880 · matplotlib/matplotlib · GitHub

Repository navigation

If text location isn't finite, set it to not visible - #7880

Closed
dstansby wants to merge 2 commits into
matplotlib:masterfrom
dstansby:inf-label-visibility
Closed

dstansby wants to merge 2 commits into
matplotlib:masterfrom
dstansby:inf-label-visibility

Conversation

Copy link
Copy Markdown
Member

This fixes #6789. The problem was there was some text at +/- inf locations, which mean that when the tight_layout calculation was being done an inf was being passed through.

I think it's reasonable to set text with co-ordinates that aren't finite to not visible as I presume it'll never be seen, although this currently just hides the problem without a warning or error. Perhaps this should raise a warning or error too? Thoughts appreciated!

anntzer commented Jan 22, 2017

Copy link
Copy Markdown
Contributor

Can the issue at #6789 also be triggered by e.g. patches at nonfinite positions? It feels like the logic of ignorining nonfinite positions should go into tight_layout itself instead (having thought approximately for 5s about the issue, so I may completely wrong).

Comment thread lib/matplotlib/text.py
"""
self.set_x(xy[0])
self.set_y(xy[1])
if not np.all(np.isfinite(xy)):

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

This will act as a latch and this text will awlays be invisible

tacaswell added this to the 2.1 (next point release) milestone Jan 22, 2017

Copy link
Copy Markdown
Member Author

@anntzer I think you're probably right (although will text at +/- infinity ever be shown?). I'll have another dig and try and fix #6789 in tight_layout soonish.

anntzer commented Jan 23, 2017

Copy link
Copy Markdown
Contributor

I guess you could have a scale that brings infinity to a finite value? :-) (although that would probably crash other parts of mpl)
The point of the suggestion is to fix the issue at its root (i.e. tight_layout, if I understand correctly), not on an artist-by-artist basis.

Copy link
Copy Markdown
Member Author

Closing this, since the eventual fix will be different. If anyone else wants to pick this up feel free.

dstansby closed this Jan 28, 2017
dstansby deleted the inf-label-visibility branch January 28, 2017 12:47
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tutorial pyplot_scales.py crashes when used with plt.tight_layout()

3 participants


Back | FazBrowse Home | New Git URL