Here is the dataset (a) I got:
First, i tried to write a code for one chart: 2 overlapping funnels - it worked (please ignore numbers on the chart, they differ from the ones on the dataset (a) )
I tried to write code for four charts and make them subplots - it didn’t work. Can you help me to find out why?:
fig_all = make_subplots(rows=1, cols=4, specs=[[{'type':'domain'}, {'type':'domain'},{'type':'domain'},{'type':'domain'}]])
#web funnel
trace=go.Funnel(y=a['Source'], x=a['all'],showlegend=False,marker={"color": 'blue'})
trace1=go.Funnel(y=a['Source'], x=a['web'], textposition='outside', marker={"color": 'red'})
fig1 = make_subplots(specs=[[{"secondary_y": True}]])
fig1.add_trace(trace)
fig1.add_trace(trace1, secondary_y=True)
fig1.layout.yaxis.update(showticklabels=False)
fig1.layout.xaxis.update({'visible': True})
fig1.for_each_trace(lambda trace: trace.update(ids=[]) if trace.name == "all" else (),)
#telesales funnel
trace=go.Funnel(y=a['Source'], x=a['all'],showlegend=False,marker={"color": 'blue'})
trace1=go.Funnel(y=a['Source'], x=a['telesales'], textposition='outside', marker={"color": 'red'})
fig2 = make_subplots(specs=[[{"secondary_y": True}]])
fig2.add_trace(trace)
fig2.add_trace(trace1, secondary_y=True)
fig2.layout.yaxis.update(showticklabels=False)
fig2.layout.xaxis.update({'visible': True})
fig2.for_each_trace(lambda trace: trace.update(ids=[]) if trace.name == "all" else (),)
#networking funnel
trace=go.Funnel(y=a['Source'], x=a['all'],showlegend=False,marker={"color": 'blue'})
trace1=go.Funnel(y=a['Source'], x=a['networking'], textposition='outside', marker={"color": 'red'})
fig3 = make_subplots(specs=[[{"secondary_y": True}]])
fig3.add_trace(trace)
fig3.add_trace(trace1, secondary_y=True)
fig3.layout.yaxis.update(showticklabels=False)
fig3.layout.xaxis.update({'visible': True})
fig3.for_each_trace(lambda trace: trace.update(ids=[]) if trace.name == "all" else (),)
#promotions funnel
trace=go.Funnel(y=a['Source'], x=a['all'],showlegend=False,marker={"color": 'blue'})
trace1=go.Funnel(y=a['Source'], x=a['promotion'], textposition='outside', marker={"color": 'red'})
fig4 = make_subplots(specs=[[{"secondary_y": True}]])
fig4.add_trace(trace)
fig4.add_trace(trace1, secondary_y=True)
fig4.layout.yaxis.update(showticklabels=False)
fig4.layout.xaxis.update({'visible': True})
fig4.for_each_trace(lambda trace: trace.update(ids=[]) if trace.name == "all" else (),)
fig_all.add_trace(fig1,1,1)
fig_all.add_trace(fig2,1,2)
fig_all.add_trace(fig3,1,3)
fig_all.add_trace(fig4,1,4)
fig_all.show()