Black Lives Matter. Please consider donating to Black Girls Code today.

Simply bar chart without any aggregation

When on the x-axis I have repetitive values, for example pear, apple, apple and 10, 20, 20, the values ​​on the y-axis are automatically aggregated so I get only two bars one for pear and one for apple. All I can do is change this function to another one, e.g. avg or min / max, but I can’t turn it off completely. How to do it?

Actually you get one bar per value of y, it’s just that’s they are placed on top of each other if they are at the same value of x. The example below shows this with color

import plotly.graph_objects as go
fig = go.Figure(go.Bar(x=['apple', 'apple', 'pear'], y=[1, 1, 2], 
                       marker_color=['orange', 'blue', 'cyan']))
fig.show()

If you want the bars to be grouped and not stacked on top of each other, then you need to define several traces as in https://plot.ly/python/bar-charts/#grouped-bar-chart