axis label change via updatemenus not working anymore in 6.0.0
Open
Nobody has claimed this yet.
bug
P1
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
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):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Python example in the issue and compare the generated test_5.24.1.html and test_6.0.0.html outputs while using the updatemenu. Trace the axis-title update behavior in the relevant Plotly code, then verify that selecting each button preserves the expected x and y labels in the generated HTML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 66/100