plotly.py
plotly.py copied to clipboard
PX doesn't force category orders on axes
This causes ordering issues like this:
import plotly.express as px
import pandas as pd
df = pd.DataFrame(dict(
x=['a','b','c','d'],
y=[1,2,3,4],
z=['p','q','p','q']
))
px.bar(df, x="x", y="y", color="z")

The workaround right now is to do category_orders=dict(x=df.z.unique()) but ideally this would be done internally.