plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.12k stars 2.54k forks source link

Update Method Example Broken #3578

Open mboll opened 2 years ago

mboll commented 2 years ago

The updatemenu method update is broken. It only updates the layout attributes. If you use the same code but change the method to restyle, it updates the data attributes as expected, but obviously this won't work if you want to update both data and layout attributes.

Recreate This is present for both the custom button and custom dropdown examples on the plotly examples page. You can see the problem by interacting with the examples.

Versions I have this behavior on plotly 5.5. My friend has this problem in version 4.14. The behavior is the same in my versions of Chrome, Firefox, Edge, and VS Code's Jupyter interface.

Edit: I updated the title after getting some more info.

mboll commented 2 years ago

After playing around a little more, it seems that this is a simple error in the example code. The figure's x-axis is using a numeric (linear) type, but the annotations are using mixed x-axis types of date and linear. Altering the example code such that the x-axis types are consistent produces the expected behavior.