8000 do not space dot when used as decimal separator · matplotlib/matplotlib@769e7f4 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit 769e7f4

Browse files
committed
do not space dot when used as decimal separator
fixes
1 parent c32bde5 commit 769e7f4

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 7 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -2504,17 +2504,22 @@ def symbol(self, s, loc, toks):
25042504
break
25052505
# Binary operators at start of string should not be spaced
25062506
if (c in self._binary_operators and
2507-
(len(s[:loc].split()) == 0 or prev_char == '{')):
2507+
(len(s[:loc].split()) == 0 or prev_char == '{' or
2508+
prev_char in self._left_delim)):
25082509
return [char]
25092510
else:
2510-
return [Hlist( [self._make_space(0.2),
2511-
char,
2512-
self._make_space(0.2)] ,
2511+
return [Hlist([self._make_space(0.2),
2512+
char,
2513+
self._make_space(0.2)] ,
25132514
do_kern = True)]
25142515
elif c in self._punctuation_symbols:
2515-
return [Hlist( [char,
2516-
self._make_space(0.2)] ,
2517-
do_kern = True)]
2516+
# Do not space dots as decimal separators
2517+
if (c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit()):
2518+
return [char]
2519+
else:
2520+
return [Hlist([char,
2521+
self._make_space(0.2)],
2522+
do_kern = True)]
25182523
return [char]
25192524

25202525
snowflake = symbol

0 commit comments

Comments
 (0)
0