python_matplotlib支持中文配置

作者: Kedi | 来源:发表于2016-02-25 10:47 被阅读162次

下载微软雅黑字体msyh.tff

  • 将字体拷贝到matplotlib安装位置,如:
    C:\Python27\Lib\site-packages\matplotlib\mpl-data\fonts
  • 修改配置文件 ,如:
    C:\Python27\Lib\site-packages\matplotlib\mpl-data/matplotlibrc
  1. backend : TkAgg #mac需要修改,windows默认就是TkAgg
  2. font.family : Microsoft YaHei(去掉开头的#,去掉原来的字体型号)
  3. font.serif : Microsoft YaHei, ......(去掉开头的#,后面的不变,只在前面加雅黑字体)
font.family         : Microsoft YaHei
font.serif          : Microsoft YaHei,Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif

OK, 大功告成,试试效果吧

相关文章

网友评论

    本文标题:python_matplotlib支持中文配置

    本文链接:https://www.haomeiwen.com/subject/hyvikttx.html