Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axis label change via updatemenus not working anymore in 6.0.0 #5032

Open
t1nux opened this issue Feb 13, 2025 · 1 comment
Open

axis label change via updatemenus not working anymore in 6.0.0 #5032

t1nux opened this issue Feb 13, 2025 · 1 comment
Labels
bug something broken P1 needed for current cycle

Comments

@t1nux
Copy link

t1nux commented Feb 13, 2025

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):

@gvwilson gvwilson added bug something broken P1 needed for current cycle labels Feb 13, 2025
@gvwilson
Copy link
Contributor

thanks @t1nux - and thanks again for the minimal example. I'll see if I can find someone to tackle this in the current work cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P1 needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants