Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How can I set multiple bars in a bar graph to the same X-value?

The task I am trying to accomplish seems counter-intuitive, but I need to do it.
I am leveraging Plotly’s capabilities to make some Python scripts that generates offline graphs given some CSV data, which I parse and input to Plotly. I am doing this because the person I am doing this for wants better-looking and more interactive graphs than the rudimentary graphs typically generated via matplotlib. One of the tasks can require me to create a grouped bar graph, in which each group has three bars to every x-value. In other words, at least three bars of the bar graph need to share the same x-value. That doesn’t make sense in actual graphing, but in matplotlib, it just shows the three bars all surrounding the one x-value - not stacked up on one another, which would not look right at all. Is it at all possible for me to accomplish this in plotly?

1 Like

This should be what you’re looking for: https://plot.ly/python/bar-charts/#grouped-bar-chart

That doesn’t do what I want - I can’t set the same group to have two bars at one x-value.