-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
“Bar chart – Overlay Mode” unexpected behavior. #1973
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
Comments
I have sort of workaround for my application. Let's say the data we are interested in is I want to plot from first row to second row and second row to third row. The following Python code would achieve that.
The trick is to write the lower bound as base and the difference as y values. This also takes care of the fact that having both positive and negative values screw things up, since the user has complete control over where each color starts and ends. The main limitation that that when you hover over the bar, as you can see in the above image, the lowest bound data does not show up ( in our example that would be 1. ) How can I fix that ? |
you can make a transparent first trace: Plotly.newPlot(gd, [{
y: [1, 2, 3],
marker: {color: 'rgba(0, 0, 0, 0)'},
type: 'bar'
}, {
y: [1, 2, 1],
type: 'bar'
}, {
y: [2, 2, 3],
type: 'bar'
}], {barmode: 'stack'}) You might also be interested in the |
@flyingBurman I think you've got workarounds to solve your particular use case, yes? I agree that it's a bit confusing, but I don't think it's a bug nor do I see a clear feature we could consider adding. I'm going to close this issue, but feel free to open a new one if you can clarify your use case as a feature request. |
This post is related to #475
Positive and negative values can be stacked on each side of the zero line.
The problem can be replicated using codepen https://codepen.io/etpinard/pen/mPGLrY with the following code.
`console.log(Plotly.version)
The output will be like this. ( You might need to click on the image to see it better. )

“Giraffes” and “orangutans” have the very similar data (1,2,3) and (3,2,1). But, the output is different depending on the order of the input. In Giraffes, trace1 and trace 2 data are never shown up and overfilled. This shouldn’t be the desired output.
What I think it should happen is that for positive values, the bars are plotted in descending order, from largest to smallest. For negative values, the bars need to be plotted in ascending order, from smallest to largest.
Please let me know if there is an easy way to fix this.
The text was updated successfully, but these errors were encountered: