1、中文显示为一个框
windows系统下matplotlib显示中文字体的方法
2、添加如下代码
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r’C:\Windows\Fonts\STSONG.TTF’, size=10) # 此文件路径为windows自带的字体路径,需要什么字体都可以此路径下找
plt.ylabel(‘个数’,fontproperties=font)
windows系统下matplotlib显示中文字体的方法

相关文章: