Python - Plotly express - facet_col/ facet_row - order categories

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?

Yikes, that just seems like a bug which we should fix! Thanks for bringing it to our attention :sweat_smile:

I’ve created an issue to track this here: https://github.com/plotly/plotly.py/issues/2084

You’re welcome! Thanks for your quick reply!

Any update on this bug? :crossed_fingers:
@nicolaskruchten

Yes, this was resolved a while ago, so if you upgrade to the latest version you shouldn’t see it any more.