Skip to content

Use \N{MICRO SIGN} instead of \N{GREEK SMALL LETTER MU} in EngFormatter. #12477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 10, 2018

This is semantically more correct, and, more importantly, is a chararacter
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.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.1 milestone Oct 10, 2018
@ImportanceOfBeingErnest
Copy link
Member

Probably a very stupid question: What's the difference between "\N{MICRO SIGN}" and "µ"?

@anntzer
Copy link
Contributor Author

anntzer commented Oct 10, 2018

None, except that by using the named entity you know immediately that's it's \u00b5 (MICRO SIGN) and not \u03bc (GREEK SMALL LETTER MU), whereas µ could be one or the other.

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.
@tacaswell tacaswell merged commit bb9892a into matplotlib:master Oct 11, 2018
@anntzer anntzer deleted the microsign branch October 11, 2018 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants