✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Bar chart relative + overlay

Hi,

Is there a way to plot something like this?
The dark blue bars represent the Total value of all the other colored relative stacked bars.

It is a mix between relative barmode and overlay barmode.

Thanks
example-barchart

Hi, Were you able to achieve it? We need a similar setup.

Try playing with this:

x = [1, 2, 3, 4]

fig = go.Figure()
fig.add_bar(x=x, y=[1, 4, 9, 16], opacity=0.7)
fig.add_bar(x=x, y=[6, -8, -4.5, 8], opacity=0.7)
fig.add_bar(x=x, y=[-15, -3, 4.5, -8], opacity=0.7)
fig.add_bar(x=x, y=[-1, 3, -3, -4], opacity=0.7)

fig.add_bar(x=x, y=[-14, 2, 2, 18], width=[0.5, 0.5, 0.5, 0.5], 
            marker_color='midnightblue', opacity=0.5, base=0)

fig.update_layout(barmode='relative')
fig.show()