8000 If text location isn't finite, set it to not visible by dstansby · Pull Request #7880 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ def test_logit_scales():
ax.grid(True)


@cleanup
def test_logit_tight_layout():
# Check that logit scale works with tight layout
fig, axs = plt.subplots(2, 2)

axs[1, 1].set_yscale('logit')
plt.tight_layout()
plt.draw()


@cleanup
def test_log_scatter():
"""Issue #1799"""
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,8 @@ def set_position(self, xy):
"""
self.set_x(xy[0])
self.set_y(xy[1])
if not np.all(np.isfinite(xy)):
Copy link
Member

Choose a reason for hiding this comment

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

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

self.set_visible(False)

def set_x(self, x):
"""
Expand Down
0