import plotly.express as px
df = px.data.tips()
fig = px.bar(df, x=“sex”, y=“total_bill”, color=“smoker”, barmode=“group”, facet_row=“time”, facet_col=“day”,
category_orders={“day”: [“Thur”, “Fri”, “Sat”, “Sun”], “time”: [“Lunch”, “Dinner”]})
fig.show()
I know how to use the category orders, but now I want the order of day to be [“Sat”, “Sun”, Thur", “Fri”]. Plotly express will still put everything in the order [“Thur”, “Fri”, “Sat”, “Sun”], due to the fact that in the first row (lunch), there is no data for Saturday and Sunday. Is there a way to force plotly express to use the given order anyways?