mac matplotlib绘图显示中文乱码问题

例子

from matplotlib.font_manager import FontProperties
font = FontProperties(fname='/Library/Fonts/Songti.ttc')
plt.title(title,fontproperties=font)
plt.ylabel('真实值',fontproperties=font)
plt.xlabel('预测值',fontproperties=font)
plt.legend(['训练集','验证集'],prop=font)

参考 https://jingyan.baidu.com/article/ab69b2709575102ca6189f67.html

保存图片控制dpi,例子
plt.savefig("filename.png", dpi=1320)

猜你喜欢

转载自www.cnblogs.com/wuyulin/p/9816454.html