解决Matplotlib中Times New Roman字体无法改变字体

解决Matplotlib中Times New Roman字体无法改变字体

问题:

在画图中使用times new roman字体时,默认为粗体,并且无法通过weight属性调节粗细。

方法:

  1. 找到目录/Users/jc/anaconda3/lib/python3.6/site-packages/matplotlib下的font_manager.py文件,将其中的weight_dict中的roman属性注释掉。
  2. python代码中加入matplotlib.font_manager._rebuild()重建后,即可显示正常粗细的Times New Roman字体。
发布了28 篇原创文章 · 获赞 16 · 访问量 3183

猜你喜欢

转载自blog.csdn.net/Newbie_J/article/details/103529954