python竖线_科学网—[转载]python-hlines and vlines(水平线和竖直线) - 张书会的博文...

refer to:

This example showcases the functions hlines and vlines.

sphx_glr_vline_hline_demo_001.pngimport matplotlib.pyplot as pltimport numpy as np

t = np.arange(0.0, 5.0, 0.1)

s = np.exp(-t) + np.sin(2 * np.pi * t) + 1

nse = np.random.normal(0.0, 0.3, t.shape) * s

fig, (vax, hax) = plt.subplots(1, 2, figsize=(12, 6))

vax.plot(t, s + nse, '^')

vax.vlines(t, [0], s)# By using ``transform=vax.get_xaxis_transform()`` the y coordinates are scaled# such that 0 maps to the bottom of the axes and 1 to the top.

vax.vlines([1, 2], 0, 1, transform=vax.get_xaxis_transform(), colors='r')

vax.set_xlabel('time (s)')

vax.set_title('Vertical lines demo')

hax.plot(s + nse, t, '^')

hax.hlines(t, [0], s, lw=2)

hax.set_xlabel('time (s)')

hax.set_title('Horizontal lines demo')

plt.show()

转载本文请联系原作者获取授权,同时请注明本文来自张书会科学网博客。

链接地址:http://blog.sciencenet.cn/blog-587102-1201640.html

上一篇:[转载]matplotlib命令与格式:标题(title),标注(annotate),文字说明(text)

下一篇:[转载]python查询字符串中指定字符的索引

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值