Hey all,
I had what I thought was a very simple problem but it has sent me through a rabbit hole and I guess I’m missing something. I was trying to make a very simple 2x1 plot. The first plot was a stacked bar plot, and the second one is a regular bar plot. But, because the barmode
argument is attached to figure’s layout, I can’t find a way to change a specific subplot’s barmode.
My code goes something like this:
trace1 = go.Bar(x=dfv['date'], y=dfv['used'],
marker_color='red')
trace2 = go.Bar(x=dfv.fecha, y=dfv.disponible
marker_color='green')
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 1)
fig.update_layout(barmode='stack')
trace3 = go.Bar(x=dfv.date, y=dfv.cost, name='Cost')
trace4 = go.Bar(x=dfv['date'], y=dfv['price'], name='Price')
fig.append_trace(trace3, 2, 1)
fig.append_trace(trace4, 2, 1)
So, how can I make traces 1 and 2 stacked and traces 3 and 4 regular barplots? I tried things likepx.bar()
, that has a barmode
argument, but it has weird interactions with add_trace()
(or I’m also missing something, so that kinda worked, but the label was lost and I had to update several properties with udpate_traces
. I also tried cufflinks
’ iplot
but barmode
was ignored by Dash.
Thanks