# encoding=utf-8 import matplotlib.pyplot as plt from pylab import * #支持中文 mpl.rcParams['font.sans-serif'] = ['SimHei'] names = ['10', '40', '60', '70', '90'] x = range(len(names)) y1 = [1,2,3,3.4,3.8] y2 = [1,2,3,3.7,4] y3 = [1,2,3,4,4.6] #pl.xlim(-1, 11) # 限定横轴的范围 plt.ylim(1,5) # 限定纵轴的范围 plt.plot(x, y1, marker='o',color='r', label=u'Dijkstra') plt.plot(x, y2, marker='*',color='g',label=u'ECMP') plt.plot(x, y3, marker='+',color='b',label=u'This paper') plt.legend() # 让图例生效 plt.xticks(x, names, rotation=45) plt.margins(0) plt.subplots_adjust(bottom=0.15) plt.xlabel(u"Load") #X轴标签 plt.ylabel("Throughput (Mb/s)") #Y轴标签 plt.title("Load and throughput") #标题 plt.show()
python应用matplotlib三条折线比较,论文作图
阅读:3327 输入:2022-06-13 19:35:47
- 上一篇:js递归遍历json并输出
- 下一篇:Mysql复制数据库及数据,数据库复制