欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Matplotlib折线图

程序员文章站 2022-04-21 17:50:34
...

先看结果:

Matplotlib折线图

code

# 准备数据
x_list = [i for i in xrange(1, 8)]
c1_precision_list = [0.829451, 0.776139, 0.658385, 0.746118, 0.309006, 0.759576, 0.799948]
c1_recall_list = [0.807195, 0.759834, 0.621894, 0.732402, 0.282609, 0.733178, 0.778468]
c1_f1_list = [0.818172, 0.767900, 0.639620, 0.739196, 0.295219, 0.746143, 0.789062]
# 绘制
plt.plot(x_list, c1_precision_list, label='precision')
plt.plot(x_list, c1_recall_list, label='recall')
plt.plot(x_list, c1_f1_list, label='f1')
plt.title('C=1')
plt.xlabel('template num')
plt.ylabel('precision / recall / f1')
plt.legend(loc='lower right')
plt.show()