matplotlib.pyplot.axvline/axvhline/axvspan/axhspan

matplotlib.pyplot.axvline/axvhline/axvspan/axhspan 实例

import numpy as np
import matplotlib.pyplot as plt
t = np.arange(-1, 2, .01)
s = np.sin(4 * np.pi * t)*np.log(t*t+1)
plt.plot(t, s)
# Draw a thick red hline at y=0 that spans the xrange 在y=0处绘制一条横跨xrange的红色粗线。
plt.axhline(linewidth=8, color='#d62728')    #RGB、RGBA十六进制形式字符串( color = '#1f77b4'blue )
# Draw a default hline at y=1 that spans the xrange             #default hline 默认的水平线
plt.axhline(y=1)
# Draw a default vline at x=1 that spans the yrange
plt.axvline(x=1)
# Draw a thick blue vline at x=0 that spans the upper quadrant of the yrange    在x=0处绘制一条横跨yRange上象限的蓝色粗垂直线。
plt.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4')
# Draw a default hline at y=.5 that spans the middle half of the axes   在Y=0.5处绘制一个横跨轴中间半部分的默认hline。
plt.axhline(y=.5, xmin=0.25, xmax=0.75)
plt.axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)          #水平带
plt.axvspan(1.25, 1.55, facecolor='#2ca02c', alpha=0.5)      #垂直带     
plt.show()
plt.show()

在这里插入图片描述
matplotlib

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值