python - 在许多图中添加辅助轴
问题描述
我正在尝试为以下图形代码添加辅助轴。我想添加带有另一个指标的辅助轴
plt.style.use('dark_background')
fig, (ax1,ax2,ax3,ax4) = plt.subplots(nrows=4, ncols=1,figsize=(18,12))
funnel.plot(x='date_event_nk', y='Show_Complete', label='Traditional',
ax=ax1)
ax1.set_title("TRADITIONAL FUNNEL AND YOLO CONVERSION PWA")
ax1.xaxis.set_label_coords(1.05, -0.025)
funnel_yolo.plot(x='date_event_nk', y='Show_Complete', label='Yolo', ax=ax2)
ax2.set_title("TRADITIONAL FUNNEL AND YOLO CONVERSION PWA")
ax2.xaxis.set_label_coords(1.05, -0.025)
funnel_smartlock.plot(x='date_event_nk', y='SMRequest_Complete',
label='Smartlock Auto', ax=ax3)
ax3.set_title('SMARTLOCK AUTO CONVERSION PWA')
ax3.set_ylim((0, 0.005))
ax3.xaxis.set_label_coords(1.05, -0.025)
funnel_smartlock_s.plot(x='date_event_nk', y='SMRequest_Complete',
label='Smartlock Select', ax=ax4)
ax4.set_title('SMARTLOCK SELECT CONVERSION PWA')
ax4.set_ylim((0, 0.1))
ax4.xaxis.set_label_coords(1.05, -0.025)
我的图表是:
为了在我尝试以下的所有图表中添加一个新的辅助轴(为简单起见,我只是在第一个图表中创建,我的问题在我的第一个图表中说明)
plt.style.use('dark_background')
fig, (ax1,ax2,ax3,ax4) = plt.subplots(nrows=4, ncols=1,figsize=(18,12))
funnel.plot(x='date_event_nk', y='Show_Complete', label='Traditional',
ax=ax1)
ax1.set_title("TRADITIONAL FUNNEL AND YOLO CONVERSION PWA")
ax1.xaxis.set_label_coords(1.05, -0.025)
ax5 = ax1.twinx()
ax5.plot(kind='bar',x='date_event_nk',y='One_tap_login',ax=ax5)
funnel_yolo.plot(x='date_event_nk', y='Show_Complete', label='Yolo', ax=ax2)
ax2.set_title("TRADITIONAL FUNNEL AND YOLO CONVERSION PWA")
ax2.xaxis.set_label_coords(1.05, -0.025)
funnel_smartlock.plot(x='date_event_nk', y='SMRequest_Complete',
label='Smartlock Auto', ax=ax3)
ax3.set_title('SMARTLOCK AUTO CONVERSION PWA')
ax3.set_ylim((0, 0.005))
ax3.xaxis.set_label_coords(1.05, -0.025)
funnel_smartlock_s.plot(x='date_event_nk', y='SMRequest_Complete',
label='Smartlock Select', ax=ax4)
ax4.set_title('SMARTLOCK SELECT CONVERSION PWA')
ax4.set_ylim((0, 0.1))
ax4.xaxis.set_label_coords(1.05, -0.025)
但无法正常工作
解决方案
推荐阅读
- reactjs - 将 Nextjs 从 v9 升级到 v10 时 Webpack 构建失败
- c++ - 调试模式和运行模式c ++的不同结果
- python-3.x - python3.x中的奇数/偶数范围
- c# - 如何定义 MarkupExtension 提供的值的类型?
- python - 使用 joblib.load 的 EOFError
- r - 绘制拟合响应与观察到的响应
- php - 使用带有 ajax 的 php mailer 发送批量消息
- c++ - 为什么这段代码可以在一个平台上运行,但不能在另一个平台上运行?
- c++ - 如何根据向量中的对象更改属性?
- python - 拆分 SSH 样式的用户@域/路径?