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

Skip to content

Commit 7c7d909

Browse files
committed
Merged revisions 8819-8820 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint ........ r8819 | mdboom | 2010-12-09 12:25:11 -0500 (Thu, 09 Dec 2010) | 2 lines [3123736] tex processor crashes when fed a space ........ r8820 | mdboom | 2010-12-09 12:26:54 -0500 (Thu, 09 Dec 2010) | 2 lines Fixed error message in Agg backend. ........ svn path=/trunk/matplotlib/; revision=8821
1 parent 77b023e commit 7c7d909

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

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):

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ RendererAgg::restore_region2(const Py::Tuple& args)
556556
}
557557
catch (Py::TypeError)
558558
{
559-
throw Py::TypeError("Invalid input arguments to draw_text_image");
559+
throw Py::TypeError("Invalid input arguments to restore_region2");
560560
}
561561

562562

0 commit comments

Comments
 (0)