python通过matplotlib用数组画图参数详解

实例

看注释over

import matplotlib.pyplot as plt#生成图要用matplotlib模块,若没有则得先安装。
import numpy as np

x1 =[0  ,0.0009 ,0.0019, 0.004, 0.0045, 0.005,  0.0055, 0.006, 0.007, 0.0075, 0.008,  0.010,]
y1= [0.8,0.9257, 0.9259, 0.9253,0.93,   0.9258, 0.9258, 0.9259,0.9269,0.9258, 0.9258, 0.926]

x2=[0,     0.0005,0.001,0.0015,0.0018,0.002,0.0025,0.003 ,0.004, 0.005, 0.006, 0.01]
y2=[0.7293,0.7938,0.800,0.801, 0.803, 0.805,0.8531,0.8391,0.8456,0.8369,0.8466,0.8477]

x3=[0,     0.0003,0.001,0.0015,0.0018,0.002,0.0025,0.003 ,0.004, 0.005, 0.006, 0.01]
y3=[0.72,  0.71  ,0.73 ,0.803, 0.804, 0.81,0.8603,0.8608,0.8666,0.868,0.8735,0.8656]

x4=[0,     0.0003,0.001,0.0015,0.0018,0.002,0.0025,0.003 ,0.004, 0.005, 0.006, 0.01]
y4=[0.18,  0.40  ,0.70 ,0.70, 0.73, 0.75,0.76,0.78,0.80,0.813,0.815,0.82]

x5=[0,     0.0003,0.001,0.0015,0.0018,0.002,0.0025,0.003 ,0.004, 0.005, 0.006, 0.01]
y5=[0.30,  0.41  ,0.67 ,0.68, 0.74, 0.745,0.75,0.756,0.757,0.756,0.777,0.789]

x6=[0,     0.002,  0.0023,0.0029,0.0035,0.004,0.0042,0.006 ,0.0065, 0.008, 0.009, 0.01]
y6=[0.0,   0.001  ,0.24 ,0.37, 0.38,    0.39, 0.4,   0.39,  0.42,  0.423, 0.435,0.44]
plt.plot(x1, y1, label='l1', color='yellow',linewidth=1)#线1
plt.plot(x2, y2, label='l2',color='green',linewidth=1)#线2
plt.plot(x3, y3, label='l3',color='pink',linewidth=1,linestyle="--")#l3 linestyle参数代表线条的样子,如-- 则线条成线段显示
plt.plot(x4, y4, label='l4',color='lime',linewidth=1,linestyle="--")#l4
plt.plot(x5, y5, label='l5',color='hotpink',linewidth=1)#l5 label代表每条线的标签名
plt.plot(x6, y6, label='l6',color='blue',linewidth=1,linestyle="--")#l6

plt.legend() # 显示标签
plt.title('a1')#设置图片标题
plt.xlabel("FRP") # 横轴名字
plt.ylabel("Recall") # 纵轴名字
plt.show()

代码运行成品图

在这里插入图片描述

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鱼雨羽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值