TA的每日心情 | 开心 2021-12-13 21:45 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
|
目前搜到的是,下载一个字体到程序路径,设置成默认字体。 https://blog.csdn.net/irene_loong/article/details/68955485
- #图表显示中文设置
- import matplotlib as mpl # 新增包
- from matplotlib.ticker import MultipleLocator, FormatStrFormatter #新增函数
- mpl.rcParams["font.size"] = 15 # 设置字体大小
- custom_font = mpl.font_manager.FontProperties(fname="../cj_data/ttf/msyh.ttf") #导入下载的字体文件
复制代码
- # 混淆矩阵 - 二元分类效果评估方法
- y_true1=list(y_test)[:100]
- cm = confusion_matrix(y_true1, y_pre)
- plt.matshow(cm)
- plt.title(u"混淆矩阵",fontproperties=custom_font)
- plt.colorbar()
- plt.ylabel(u"实际类型",fontproperties=custom_font)
- plt.xlabel(u"预测类型",fontproperties=custom_font)
- plt.show()
复制代码
|
|