✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

ERROR: (px.scatter + marginal_y + categoryorder) crashes

Dear community,

it seems that setting the categoryorder of the x-axes makes px.scatter figures crash when using marginal plots:

import pandas as pd
import plotly.express as px # plotly 4.9.0

df = pd.DataFrame({'x':['c', 'a', 'b'], 'y':[1,2,1]})
fig = px.scatter(df, x='x', y='y', marginal_y='box')
fig.update_xaxes(categoryorder='category ascending') # Line x
fig.show(renderer='browser')
# Only works, if line x is removed, or when parameter marginal_y='box' is removed

Is this a bug or am I using the function the wrong way?

Cheers