"Stack" vs "Relative" barmode
See original GitHub issueHi There,
First off, thanks for making and open-sourcing this library; it is proving very useful.
I wanted to propose a tiny code change to 2 lines in the instantiation of the plotly renderers in PlotlyRenderes.jsx. Specifically, I’m wondering if the layout options passed into the two stacked bar charts could specify { barmode: 'relative' }
instead of { barmode: 'stack' }
.
There may be reasons not to do it, which I’m not aware of, because I’m far from intimately familiar with plotly.js. However, the reason pro doing it is that currently, with { barmode: 'stack' }
, if there are any negative values in the data, their bars end up overlapping and covering up other bars instead of sticking out on the negative side of the chart. In other words, as far as I can tell, when there are negative values, ‘stack’ mode results in a bug while ‘relative’ mode does what you’d expect. And I don’t think there’s a case where the opposite is true.
The only discussion I’ve found about this so far is this forum post in which someone points out this issue and Etienne addresses by creating the new { barmode: 'relative' }
. However, no explanation is given as to why a new mode was needed instead of modifying the ‘stack’ mode.
Thanks for your consideration.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Also, thanks to your issue, we finally resolved https://github.com/plotly/documentation/issues/926 such that
barmode
now appears here alongside all the otherlayout
attributes https://plot.ly/javascript/reference/#layout-barmode so thanks for the nudge 😃@nicolaskruchten Super! Thanks – both for making and releasing the change, and for doing all the prerequisite sifting.