8000 Nan issue by ffteja · Pull Request #4235 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Nan issue #4235

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 3 commits into from
Closed
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
8 changes: 5 additions & 3 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ def draw(self, renderer):
posx = float(self.convert_xunits(self._x))
posy = float(self.convert_yunits(self._y))

if not np.isfinite(posx) or not np.isfinite(posy):
raise ValueError("posx and posy should be finite values")

posx, posy = trans.transform_point((posx, posy))
canvasw, canvash = renderer.get_canvas_width_height()

Expand All @@ -627,14 +630,13 @@ def draw(self, renderer):
angle = self.get_rotation()

for line, wh, x, y in info:
if not np.isfinite(x) or not np.isfinite(y):
continue

mtext = self if len(info) == 1 else None

x = x + posx
y = y + posy
if renderer.flipy():
y = canvash - y

clean_line, ismath = self.is_math_text(line)

if self.get_path_effects():
Expand Down
0