import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
# lambda1 = [0.05, 0.1, 0.2, 0.5, 0.6]
lambda1 = [ 10 ,20 ,30 ,40 ,50 ,100, 150 ,200, 250, 300, 350, 400, 450, 500, 550, 600
]
accuracy = [ 69.3505, 76.5825, 79.4422, 80.6818, 82.0704, 83.9992, 84.8017, 86.0948, 85.5095,
86.7016, 86.9798, 87.3853, 86.8645, 87.4546, 87.0539, 87.4681
]
flops = [ 70.2262, 79.335, 79.98, 82.86, 83.6624 ,85.9866, 86.0221, 86.5763, 87.2489, 87.6942,
87.6937, 87.7275, 88.033, 87.9616, 88.1631, 87.81
]
# params = [58.96, 61.27, 73.99, 76.88, 84.97]
plt.plot(lambda1, flops, c='blue', marker='o', linestyle=':', label='SwinU')
plt.plot(lambda1, accuracy, c='red', marker='*', linestyle='-', label='Our')
# plt.plot(lambda1, params, c='green', marker='+', linestyle='--', label='parameters')
#设置图例并且设置图例的字体及大小
font1 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 10}
plt.xticks(fontproperties = 'Times New Roman',fontsize=10)
plt.yticks(fontproperties = 'Times New Roman',fontsize=10)
plt.xlabel(u'λ', font1)
plt.ylabel(u'Pruned Percentage & Accuracy (%)', font1)
# 图例展示位置,数字代表第几象限
plt.legend(loc=4, prop=font1)
# Axes(ax)对象,主要操作两个坐标轴间距调整可更改X轴的间隔
x_major_locator = MultipleLocator(50)
ax = plt.gca()
ax.xaxis.set_major_locator(x_major_locator)
plt.show()
Python绘制折线图
最新推荐文章于 2024-02-21 14:00:48 发布