目前搜到的是,下载一个字体到程序路径,设置成默认字体。  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()

  

 

相关文章:

  • 2022-02-16
  • 2021-09-25
  • 2021-11-23
  • 2022-02-19
  • 2021-04-19
  • 2022-01-14
猜你喜欢
  • 2021-12-11
  • 2021-03-26
  • 2022-12-23
  • 2021-07-18
  • 2021-10-24
  • 2021-11-06
  • 2021-12-25
相关资源
相似解决方案