Skip to content

Commit 54037c1

Browse files
committed
Use \N{MICRO SIGN} instead of \N{GREEK SMALL LETTER MU} in EngFormatter.
This is semantically more correct, and, more importantly, is covered by the pdf 14 core fonts: after ``` from matplotlib.ticker import EngFormatter from pylab import * rcParams["pdf.use14corefonts"] = True fig, ax = plt.subplots() ax.semilogx([1e-6, 1e-5], [0, 1]) ax.xaxis.set_major_formatter(EngFormatter(unit="s")) savefig("/tmp/test.pdf") ``` we previously got a pdf where the µ signs were replaced by question marks (actually this happens at the encoding to cp1252 stage), whereas with the fix, the µ signs appear correctly.
1 parent e08d7ba commit 54037c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/ticker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ class EngFormatter(Formatter):
11871187
-15: "f",
11881188
-12: "p",
11891189
-9: "n",
1190-
-6: "\N{GREEK SMALL LETTER MU}",
1190+
-6: "\N{MICRO SIGN}",
11911191
-3: "m",
11921192
0: "",
11931193
3: "k",
@@ -1251,7 +1251,7 @@ def format_eng(self, num):
12511251
'1.0 M'
12521252
12531253
>>> format_eng("-1e-6") # for self.places = 2
1254-
'-1.00 \N{GREEK SMALL LETTER MU}'
1254+
'-1.00 \N{MICRO SIGN}'
12551255
"""
12561256
sign = 1
12571257
fmt = "g" if self.places is None else ".{:d}f".format(self.places)

0 commit comments

Comments
 (0)