原因:matplotlib中没有中文字体
环境:win7+python3.6
解决办法:
1.打开配置文件
import matplotlib
matplotlib.matplotlib_fname()
可以得到配置文件matplotlibrc地址
用文本编辑器打开配置文件
2.修改配置文件
将文件中的
#font.family: sans-serif
去掉注释,修改为
font.family: arial unicode ms
打开C:\Windows\Fonts文件夹,把arial unicode ms字体复制粘贴到配置文件matplotlibrc同目录下的Fonts文件夹中。
到C:\Users\用户名.matplotlib,把里面的缓存文件删除。
重启python即可显示为中文