Yep, it was that… but I couldn’t figure out WHY.
Seems to me that plotly charts try to make inferences about the data.
Pretty smart normally… but in this case it just siezes on the numerical ones…
Anyway… turns out there is a setting for it…
title_text='Bar chart with categorical axes')
But I had to do a little bit more to get the ordering of the categories the way I wanted…
Here’s the full code…
fig = px.bar(df_percent, x="peoplecnt", y="Percentage", color='Wave', barmode='group',
# force plotly to treat x as categorical data
title_text='People outside household face to face')
# tell plotly what order we want the categories in
'categoryarray' : ("None", "1","2","3","4","5","Over 5")