首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >图为熊猫多Y轴图

图为熊猫多Y轴图
EN

Stack Overflow用户
提问于 2021-11-07 14:36:52
回答 1查看 246关注 0票数 0

有人能给我一个提示,告诉我如何在我的情节中加入一个传奇吗?我很满意剧情的样子,只是需要一个传说:)

代码语言:javascript
复制
# data from pandas df's
zoom_plot = fc1_dataset.loc['2021-8-9'].between_time('5:00', '17:00')
_no_vfd_sig = zoom_plot[['fc1_flag','duct_static','duct_static_setpoint']]
_vfdsig = zoom_plot.vfd_speed


# using subplots() function
fig, ax = plt.subplots(figsize=(25,8))
plt.title('Visually verify FDD is flagging OK')
 
# using the twinx() for creating another
# axes object for secondary y-Axis
ax2 = ax.twinx()
ax.plot(zoom_plot.index, _no_vfd_sig)
ax2.plot(zoom_plot.index, _vfdsig, color = 'r')
 
# giving labels to the axises
ax.set_xlabel('Date')
ax.set_ylabel('Duct Pressure and FDD Flag')

# secondary y-axis label
ax2.set_ylabel('% Fan Speed')

# defining display layout
plt.tight_layout()
 
# show plot
plt.show()

输出:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-07 15:27:33

和之前的代码一样。

代码语言:javascript
复制
plot1, = ax.plot(zoom_plot.index, _no_vfd_sig)
plot2, = ax2.plot(zoom_plot.index, _vfdsig, color = 'r')

ax.set_xlabel('Date')
ax.set_ylabel('Duct Pressure and FDD Flag')

# secondary y-axis label
ax2.set_ylabel('% Fan Speed')

plt.legend([plot1,plot2],["plot 1", "plot 2"])

# defining display layout
plt.tight_layout()

# show plot
plt.show()
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69873400

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档