One approach to solve this might be to check the column data types for all columns mapped to a visual element and if they are ordered pandas categoricals, set the plot order via category_orders to be df['col'].cat.categories. So, essentially automating the below:
I am not sure if there would be any cases when it would be disadvantageous to use the pandas order. At least for x, y, color, and facets I think it makes sense, thoughts?
It would be nice if px could infer the order of categorical columns if they are already set in pandas.
One approach to solve this might be to check the column data types for all columns mapped to a visual element and if they are ordered pandas categoricals, set the plot order via
category_orders
to bedf['col'].cat.categories
. So, essentially automating the below:I am not sure if there would be any cases when it would be disadvantageous to use the pandas order. At least for x, y, color, and facets I think it makes sense, thoughts?