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 with a scatter, like this:
In this case it isn’t really a problem, but if I wanted to use two different barmodes for my subplots, what could I do? Because barmode
is linked to the figure’s layout
I can’t seem to find a way to plot two types of barmodes
in different subplots.
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)
trace3 = go.Bar(x=dfv.date, y=dfv.total, name='Total ')
trace4 = go.Scatter(x=dfv['date'], y=dfv['percentage'], name='% ')
fig.append_trace(trace3, 2, 1)
fig.append_trace(trace4, 2, 1)
fig.update_layout(barmode='stack')
Si if trace4
was also a bar and I wanted non-stacked bars for this one, what could I do?
Thanks
Edit: I saw px.bar()
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 updated several properties with udpate_traces
. I also tried cufflinks
’ iplot
but barmode
was ignored by Dash.