Python 在许多图中添加次轴
我试图在下面的图形代码中添加一个次轴。我想用另一个度量添加一个次轴Python 在许多图中添加次轴,python,matplotlib,plot,seaborn,Python,Matplotlib,Plot,Seaborn,我试图在下面的图形代码中添加一个次轴。我想用另一个度量添加一个次轴 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 FUN
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)
我的图表是:
为了在所有图形中添加一个新的次轴,我尝试以下操作
(为了简单起见,我只在第一张图中创建,我的问题在第一张图中说明)
但是工作不正常是否要添加第二个x轴?您是否查看过是否有与您需要/想要的类似的内容?哪些内容无法正常工作?你遇到了什么问题?上图中的问题是什么?出现以下错误“inner()为参数'ax'获取了多个值”,哪一行抛出了错误?它看起来像来自
ax5.plot(kind='bar',x='date\u event\u nk',y='One'u tap\u login',ax=ax5)
。它是?在我看来,您应该编写ax5.plot(kind='bar',x='date\u event\u nk',y='One'u tap\u login')
而不是ax5.plot(…,ax=ax5)
您想编写漏斗图(…,ax=ax5)
。
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)