Group bars and continuous colorscale

I have noticed a wierd behaviour when using barmode=group and passing a numerical data column to color attribute of the px.bar function

import plotly.express as px
df = px.data.tips()
fig = px.bar(df, x="sex", y="total_bill",
             color='total_bill', barmode='group',
             height=400)
fig.show()

Why does it render a stacked bar chart?


Does it not support having continuous colorscale for grouped bars?

Hi @dataturnsmeon, whether you specify barmode = 'group' or not you get the same result, so I would say this behavior does not come from the barmode.

You might want to use a histogram in this case rather than a bar chart and pass the column 'sex' into the color argument.