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

Skip to content

Commit 358cdee

Browse files
committed
fix string edge behaviour for comma and dot
1 parent fbb9bbc commit 358cdee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/matplotlib/mathtext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2658,11 +2658,12 @@ def symbol(self, s, loc, toks):
26582658

26592659
# Do not space commas between brackets
26602660
if c == ',':
2661+
prev_char, next_char = '', ''
26612662
for i in six.moves.xrange(1, loc + 1):
26622663
prev_char = s[loc - i]
26632664
if prev_char != ' ':
26642665
break
2665-
for i in six.moves.xrange(1, loc + 1):
2666+
for i in six.moves.xrange(1, len(s) - loc):
26662667
next_char = s[loc + i]
26672668
if next_char != ' ':
26682669
break

lib/matplotlib/tests/test_mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
' '.join('$\\' + p + '$' for p in sorted(mathtext.Parser._snowflake)),
106106
r'$6-2$; $-2$; $ -2$; ${-2}$; ${ -2}$; $20^{+3}_{-2}$',
107107
r'$\overline{\omega}^x \frac{1}{2}_0^x$', # github issue #5444
108-
r'$1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799
108+
r'$,$ $.$ $1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799
109109
]
110110

111111
digits = "0123456789"

0 commit comments

Comments
 (0)