Custom button to show/hide traces of bar chart does not work with categoryorder

Does anyone know how to create a custom button to display traces of a bar graph but sorted in descending order?

import pandas as pd

df = pd.DataFrame({‘Name’ : [‘Rachel’, ‘Mike’, ‘Bella’, ‘Jerry’,‘Foo’, ‘Barry’],
‘1M’ : [1.2, 2.3, 1.3, 0.4, 3.5, 2.6],
‘3M’ : [2.0, 5.0, 4.3, 1.2, 2.3, 0.9],
‘VIP’:[‘Y’,‘N’,‘N’,‘N’,‘Y’,‘N’]})

this works fine

fig1 = px.bar(data_frame = df, x = ‘Name’,y = ‘1M’,color = ‘VIP’)
fig1.update_layout({“xaxis”: {‘categoryorder’: ‘total descending’}})
fig1.show()

this works fine

fig2 = px.bar(data_frame = df, x = ‘Name’,y = ‘3M’,color = ‘VIP’)
fig2.update_layout({“xaxis”: {‘categoryorder’: ‘total descending’}})
fig2.show()

create button that just flicks between two graphs

this does not work

fig = go.Figure()
fig.add_trace(fig1.data[0])
fig.add_trace(fig1.data[1])
fig.add_trace(fig2.data[0])
fig.add_trace(fig2.data[1])

fig.data[2].visible =False
fig.data[3].visible =False
fig.show()

fig.update_layout(
updatemenus=[
dict(
type=“buttons”,
direction=“right”,
x=0.7,
y=1.2,
showactive=True,
buttons=list(
[
dict(
label=“1M”,
method=“update”,
args=[{“visible”: [True, True, False,False]},
{“xaxis”: {“categoryorder”: “total descending”}}]
),
dict(
label=“3M”,
method=“update”,
args=[{“visible”: [False, False, True, True]},
{“xaxis”: {“categoryorder”: “total descending”}}]
),
]
),
)
]
)
fig.show()