10000 FIX: move non-finite position check in text.draw · matplotlib/matplotlib@b9bf090 · GitHub
[go: up one dir, main page]

Skip to content

Commit b9bf090

Browse files
fftejatacaswell
authored andcommitted
FIX: move non-finite position check in text.draw
closes #4066
1 parent 2c4aa6d commit b9bf090

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/text.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,9 @@ def draw(self, renderer):
733733

734734
renderer.open_group('text', self.get_gid())
735735

736+
if not np.isfinite(posx) or not np.isfinite(posy):
737+
raise ValueError("posx and posy should be finite values")
738+
736739
with _wrap_text(self) as textobj:
737740
bbox, info, descent = textobj._get_layout(renderer)
738741
trans = textobj.get_transform()
@@ -760,8 +763,6 @@ def draw(self, renderer):
760763
angle = textobj.get_rotation()
761764

762765
for line, wh, x, y in info:
763-
if not np.isfinite(x) or not np.isfinite(y):
764-
continue
765766

766767
mtext = textobj if len(info) == 1 else None
767768
x = x + posx

0 commit comments

Comments
 (0)
0