Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9a9fe2

Browse files
committed
[3123736] tex processor crashes when fed a space
svn path=/branches/v1_0_maint/; revision=8819
1 parent d7a06da commit c9a9fe2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/text.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ def draw(self, renderer):
551551

552552
if rcParams['text.usetex']:
553553
for line, wh, x, y in info:
554+
if not np.isfinite(x) or not np.isfinite(y):
555+
continue
556+
554557
x = x + posx
555558
y = y + posy
556559
if renderer.flipy():
@@ -566,6 +569,9 @@ def draw(self, renderer):
566569
self._fontproperties, angle)
567570
else:
568571
for line, wh, x, y in info:
572+
if not np.isfinite(x) or not np.isfinite(y):
573+
continue
574+
569575
x = x + posx
570576
y = y + posy
571577
if renderer.flipy():
@@ -974,6 +980,8 @@ def is_math_text(s):
974980
# Did we find an even number of non-escaped dollar signs?
975981
# If so, treat is as math text.
976982
if rcParams['text.usetex']:
983+
if s == ' ':
984+
s = r'\ '
977985
return s, 'TeX'
978986

979987
if cbook.is_math_text(s):

0 commit comments

Comments
 (0)