Python绘制折线图

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()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值