当前位置:   article > 正文

一张图看懂python-Python 如何将不同数量级的数据画在同一张图上?

如何将不同量级的数值放在一张图表上

# If we were to simply plot pts, we'd lose most of the interesting

# details due to the outliers. So let's 'break' or 'cut-out' the y-axis

# into two portions - use the top (ax) for the outliers, and the bottom

# (ax2) for the details of the majority of our data

f, (ax, ax2) = plt.subplots(2, 1, sharex=True)

# plot the same data on both axes

ax.plot(pts)

ax2.plot(pts)

# zoom-in / limit the view to different portions of the data

ax.set_ylim(.78, 1.) # outliers only

ax2.set_ylim(0, .22) # most of the data

# hide the spines between ax and ax2

ax.spines['bottom'].set_visible(False)

ax2.spines['top'].set_visible(False)

ax.xaxis.tick_top()

ax.tick_params(labeltop='off') # don't put tick labels at the top

ax2.xaxis.tick_bottom()

# This looks pretty good, and was fairly painless, but you can ge

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/963848
推荐阅读
相关标签
  

闽ICP备14008679号