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

Skip to content

Commit 0373d1b

Browse files
committed
Handle \times in strip_math to better handle LogFormatter.
1 parent 4dda553 commit 0373d1b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,18 @@ def strip_math(s):
309309
"""
310310
if len(s) >= 2 and s[0] == s[-1] == "$":
311311
s = s[1:-1]
312-
remove = [
313-
r'\mathdefault', r'\rm', r'\cal', r'\tt', r'\it', '\\', '{', '}']
314-
for r in remove:
315-
s = s.replace(r, '')
312+
for tex, plain in [
313+
(r"\times", "x"), # Specifically for Formatter support.
314+
(r"\mathdefault", ""),
315+
(r"\rm", ""),
316+
(r"\cal", ""),
317+
(r"\tt", ""),
318+
(r"\it", ""),
319+
("\\", ""),
320+
("{", ""),
321+
("}", ""),
322+
]:
323+
s = s.replace(tex, plain)
316324
return s
317325

318326

0 commit comments

Comments
 (0)