Hi @adamschroeder
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…
fig.update_layout(xaxis_type='category',
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',
height=400)
# force plotly to treat x as categorical data
fig.update_layout(xaxis_type='category',
title_text='People outside household face to face')
# tell plotly what order we want the categories in
fig.update_xaxes({'categoryorder':'array',
'categoryarray' : ("None", "1","2","3","4","5","Over 5")
})
fig.show()