updatemenu button moves on 2nd click
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
Adding an updatemenu button to toggle the legend, the button shifts to the left on 2nd click under certain conditions.
Minimal Example
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
legend = dict(
x=1, y=1, xanchor="right", yanchor="top", groupclick="toggleitem"
)
legend_toggle = dict(
args=["showlegend", True],
args2=["showlegend", False],
label="Toggle legend",
method="relayout",
)
fig.update_layout(
legend=legend,
updatemenus=[
dict(type="buttons", buttons=[legend_toggle], showactive=True, x=1, y=1)
],
)
fig.update_xaxes(range=[0, 10])
fig.show()
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 by running the minimal Python example and reproducing the second-click movement of the updatemenu button while toggling the legend. Trace the legend and updatemenu layout handling, then verify that repeated toggles leave the button position unchanged under the reported conditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100