Skip to content

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

Open

Description

@t1nux

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

Activity

  1. added
    bugsomething broken
    P1needed for current cycle
    on Feb 13, 2025
  2. gvwilson commented on Feb 13, 2025

    @gvwilson
    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.

  3. emilykl commented on Sep 2, 2026

    @emilykl
    Contributor

    Possibly related to #5060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1needed for current cyclebugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions