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
request : could the default windows font of matplotlib support an utf-8 "µ" ? #2397
Comments
The error message says:
You are using a regular 8-bit string (assuming you are on Python 2). You should instead use a Unicode string:
|
Hi, I'm on a python3.3 windows 32bit (vista) installation. (winpython 3.3.2.3 precisely) Re-doing more carefully the test
C:\Users\parent\Desktop\winpython\WinPython-32bit-3.3.2.3\python-3.3.2\lib\site-packages\matplotlib\mathtext.py:876: MathTextWarning: Font 'default' does not have a glyph for 'b'\u03bc'' [U3bc] (\u03bc is "µ" in utf16, apparently http://www.fileformat.info/info/unicode/char/3bc/index.htm) |
Most likely, that error message is correct: your font (which you've set to Arial) does not have that character. You can confirm this by opening the font in a tool that will show its glyph set (such as fontforge). Try another font with better unicode coverage. |
My real question is , what/which tool select this default font , is it Matplotlib default ? |
No, the default is Bitstream Vera Sans, which has this character. You have changed it here:
|
So, If I understand well, this is the tool calling matplotlib that changes the default to a non-pertinent value ? |
Hello,
In Default Matplotlib the "latin1" µ prints well, but the "utf-8" µ apparently doesn't.
Would it be possible to be 'by default' , on windows in
plt.rc('font', **{'sans-serif' : 'Arial', 'family' : 'sans-serif'})
** sample code and post explaining the problem **
-- coding: utf-8 --
from matplotlib import pyplot as plt
plt.plot([1,2],[3,4])
change the default matplotlib font, that doesn't print the utf-8 µ !
the 'well-known' latex definition$\mu$ works perfect in any case
ref :http://stackoverflow.com/questions/10960463/non-ascii-characters-in-matplotlib
plt.rc('font', **{'sans-serif' : 'Arial', 'family' : 'sans-serif'})
plt.xlabel("A distance (μm) (or $\mu$m)")
plt.show()
The text was updated successfully, but these errors were encountered: