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

Skip to content

Commit 61a0cdd

Browse files
committed
Make EngFormatter use math font when usetex is True
1 parent 936855c commit 61a0cdd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/matplotlib/ticker.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,9 +1283,12 @@ def format_eng(self, num):
12831283
pow10 += 3
12841284

12851285
prefix = self.ENG_PREFIXES[int(pow10)]
1286-
1287-
formatted = "{mant:{fmt}}{sep}{prefix}".format(
1288-
mant=mant, sep=self.sep, prefix=prefix, fmt=fmt)
1286+
if rcParams['text.usetex']:
1287+
formatted = "${mant:{fmt}}${sep}{prefix}".format(
1288+
mant=mant, sep=self.sep, prefix=prefix, fmt=fmt)
1289+
else:
1290+
formatted = "{mant:{fmt}}{sep}{prefix}".format(
1291+
mant=mant, sep=self.sep, prefix=prefix, fmt=fmt)
12891292

12901293
return formatted
12911294

0 commit comments

Comments
 (0)