Skip to content

"Stack" vs "Relative" barmode #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
meetamit opened this issue Apr 24, 2018 · 7 comments
Closed

"Stack" vs "Relative" barmode #27

meetamit opened this issue Apr 24, 2018 · 7 comments

Comments

@meetamit
Copy link

meetamit commented Apr 24, 2018

Hi 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.

@nicolaskruchten
Copy link
Contributor

Thanks for bringing this to my attention! I'll look into it shortly, but right now I can't seem to find any barmode documentation at all in our official docs, so I'll need to fix that first :)

@nicolaskruchten
Copy link
Contributor

Tracking in plotly/documentation#926

@meetamit
Copy link
Author

Great, thanks. I'm no sure whether what I encountered was official docs but, FWIW, I did see a specification of barmode (along with relative) in the JavaScript API, on the bar charts page

@nicolaskruchten
Copy link
Contributor

@nicolaskruchten
Copy link
Contributor

Also, thanks to your issue, we finally resolved plotly/documentation#926 such that barmode now appears here alongside all the other layout attributes https://plot.ly/javascript/reference/#layout-barmode so thanks for the nudge :)

@nicolaskruchten
Copy link
Contributor

Edit: this is the longstanding issue that was resolved plotly/documentation#202

@meetamit
Copy link
Author

meetamit commented May 8, 2018

@nicolaskruchten Super! Thanks -- both for making and releasing the change, and for doing all the prerequisite sifting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants