-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Incorrect selection of Times New Roman Bold #5574
Comments
#5414, while not ready immediately, should address this by using font-config rather than our own homegrown code for font lookup. That's our long term solution to these sorts of problems, but won't be ready until at least matplotlib 2.1, maybe later. As for the actual problem at hand, I'm having trouble reproducing it. With the Times New Roman Bold that ships with Win8 (which has the filename |
I recently started seeing this problem on OSX as well. The default Times fonts are named: |
I experienced the same problem. In font_manager.py the weight is set by scanning the font properties from sfnt4 = sfnt.get((1,0,0,4)) in the weight_dict. On simple solution is to remove "roman" from the weight_dict. Ideally would be a more sophisticated method to scan. |
Just encountered this problem as well. It can be fixed locally with del matplotlib.font_manager.weight_dict['roman']
matplotlib.font_manager._rebuild() |
I started seeing this same problem recently, when I upgraded from matplotlib 1.5 to 2.0 |
Just chiming in to say that this is happening also to me, in Windows 10, with matplotlib 2.0 and anaconda, python 3.6 Edit: I confirm that the answer by azag0 works, i.e. del matplotlib.font_manager.weight_dict['roman']
matplotlib.font_manager._rebuild() |
Windows 10 with matplotlib 2.1.2 and anaconda |
This is happening for me with Matplotlib 2.2.2 on a Windows 10 machine. I assume there is no global fix to this solution other than the adding the local code provided by azag0. This code returns "KeyError: 'roman'"every time I run it and I would like to find a way to fit it without the error showing up. |
I upgraded from Python 3.5.4 with matplotlib 2.0.2 to Python 3.7.1 with matplotlib 3.0.2 and this was suddenly a problem. The local fix works. I'm on Windows 7. |
This problem re-appeared when I upgraded to matplotlib 3.0.2 (macOS 10.13.6, Python.org's Python 3.7.2); azag0's fix worked again. |
Same here when upgrading from 3.0.3 to 3.10.0.
did NOT solve the problem. Instead it completely crashed my fontmanager, raising several errors. Unluckily I had a deadline pressuring me to get back to work asap, thus I did not have the time to write down everything. |
I fixed this by changing importing : import matplotlib.font_manager
del matplotlib.font_manager.weight_dict['roman']
matplotlib.font_manager._rebuild() and it works when using jhrmnn's method, I got error : AttributeError: module 'matplotlib' has no attribute 'font_manager'
my codes: import matplotlib as mpl
print(dir(mpl))
del mpl.font_manager.weight_dict['roman']
mpl.font_manager._rebuild()
from matplotlib import rcParams
rcParams['font.family'] = 'Times New Roman'
# rcParams['font.sans-serif'] = ['Tahoma']
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], label='test')
ax.legend()
plt.show() any help ? |
On both my Mac and Linux setup (mpl 1.5.0) is appears that the bold version is selected over the regular one, as both are understood to have the same weight.
See this question on StackOverflow where I described the problem and the "solution".
http://stackoverflow.com/questions/33955900/matplotlib-times-new-roman-appears-bold/33962423#33962423
Please close this issue if this is an actual font problem unrelated to mpl.
The text was updated successfully, but these errors were encountered: