Stacked bar with positive and negative values

Hi guys,

I have data for a stacked bar with both positive and negative values. I would like the negative values to render below the x axis and stack and the positive values to render above the x axis and stack. I have tried stack and overlay MODE and in both cases at least one of my datapoints is being hidden behind another bar. MODE = group renders as expected with negative values below the line. Is this a bug?

Sounds like a similar unresolved problem here:

Many thanks.

1 Like

This is the intended behaviour of the stack and overlay bar modes at the moment.

Your use case seems pretty common, I’m thinking we add another barmode value e.g. 'stack-relative'

Please subscribe to for the latest development info.

That would be awesome. Thanks.

What are the use cases of the “intended behaviour” ?

A new barmode has been added in the latest plotly.js release.

This example compares the different barmode values.