python绘图工具包 matplotlib 中文乱码问题

环境:

python2.7

windows 8.1

解决:

改配置文件,把字体改为支持中文的字体。

找到python安装目录下的 Libsite-packagesmatplotlibmpl-datamatplotlibrc 文件

把这一行

#font.sans-serif     : DejaVu Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif

注释去掉,在冒号后面添加 SimHei,可以正常显示中文标签。

再把

#axes.unicode_minus  : True

注释去掉,把冒号后面改成False可以正常显示正负号。

原文地址:https://www.cnblogs.com/wangyiming/p/6425450.html