Open
Description
When using fig.update_layout(updatemenus=updatemenus)
to change the label of an axis, the axis label just disappears.
Here you find a minimum example that works in 5.24.1 but not anymore in 6.0.0.
import plotly.graph_objects as go
import pandas as pd
data = pd.DataFrame({'x0': (1, 2, 3),
'x1': (1, 2, 5),
'y0': (5, 6, 8),
'y1': (6, 5, 9)})
fig = go.Figure()
fig.add_trace(go.Scatter(x=data['x0'],
y=data['y0'],
name='0'))
fig.update_xaxes(title='x0')
fig.update_yaxes(title='y0')
bt = []
bt.append(dict(method='update',
label='0',
args=list((
dict(x=[data['x0']],
y=[data['y0']]),
dict(xaxis=dict(title='x0'),
yaxis=dict(title='y0'))
))))
bt.append(dict(method='update',
label='1',
args=list((
dict(x=[data['x1']],
y=[data['y1']]),
dict(xaxis=dict(title='x1'),
yaxis=dict(title='y1'))
))))
updatemenus = [{'buttons': bt,
'showactive': True}]
fig.update_layout(updatemenus=updatemenus)
fig.show(config={'displayModeBar': False})
# fig.write_html('test_5.24.1.html', config={'displayModeBar': False})
fig.write_html('test_6.0.0.html', config={'displayModeBar': False})
To quickly test on the output html files (try the dropdown menu and look at the labels):