- 1 标题
- 2 坐标轴
- 3 标注
- 4 示例
- 5 展示
- 6 说明
plt.xlabel('False positive rate', fontdict={"family": "Times New Roman", "size": 25}) plt.ylabel('True positive rate', fontdict={"family": "Times New Roman", "size": 25})2 坐标轴
plt.xticks(fontname="Times New Roman", fontsize=25) plt.yticks(fontname="Times New Roman", fontsize=25)3 标注
plt.legend(["ave", "csd"], ncol=2, prop={"family": "Times New Roman", "size": 20})4 示例
import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import roc_curve, auc ave_y = [1, 1, 0, 1, 1, 1, 1, 0, 1, 0] ave_s = [0.8446268912125952, 0.31044467203460036, -1.33226607152782, 0.8723786813348764, 1.2283086907437264, 0.33636548278669043, 0.9052825218445952, 0.08347692816827568, 0.07993405539801257, 0.06265025380038125] csd_y = [1, 0, 0, 1, 1, 0, 1, 0, 1, 0] csd_s = [1.4413071851259032, -0.8908316020574051, -0.6636019236395063, 0.7719003849338849, 0.9547960178329018, -0.4345882448951329, 1.0528130339236261, -0.6253665734137726, 0.4713812846967531, 0.8398653871340798] def plot_auc(y, score, color="r"): """""" fpr, tpr, _ = roc_curve(y, score) plt.plot(fpr, tpr, color=color, lw=lw, label='ROC curve (area = %0.2f)' % auc(fpr, tpr)) lw = 5 plt.figure(figsize=(10, 10)) plt.subplots_adjust(left=0.095, bottom=0.08, right=0.96, top=0.98) plt.xlim([-0.03, 1.0]) plt.ylim([0.0, 1.03]) plt.xticks(fontname="Times New Roman", fontsize=25) plt.yticks(fontname="Times New Roman", fontsize=25) plot_auc(ave_y, ave_s, color="#7e1e9c") plot_auc(csd_y, csd_s, color="g") plt.xlabel('False positive rate', fontdict={"family": "Times New Roman", "size": 25}) plt.ylabel('True positive rate', fontdict={"family": "Times New Roman", "size": 25}) plt.legend(["ave", "csd"], ncol=2, prop={"family": "Times New Roman", "size": 20}) plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--') plt.show()5 展示 6 说明
更多字体样式需要另行查找。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)