Skip to content

Using restyle method in updatemenus button removes the modebar #4974

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

Closed
HunterMcGushion opened this issue Jun 30, 2020 · 3 comments · Fixed by #5181
Closed

Using restyle method in updatemenus button removes the modebar #4974

HunterMcGushion opened this issue Jun 30, 2020 · 3 comments · Fixed by #5181
Labels
bug something broken

Comments

@HunterMcGushion
Copy link

This is very similar to #3824, and this bug was first reported in this comment by @sermeor, but I thought it made sense to open a new issue.

The issue can be reproduced on the Plotly website in the "Restyle Button Single Attribute" example.

On initial load, hovering over the plot brings up the modebar.
Screen Shot 2020-06-30 at 2 12 29 PM

However, after clicking the "Heatmap" button, the modebar no longer appears.
Screen Shot 2020-06-30 at 2 13 19 PM

The same thing happens when changing the trace type in other examples on this page.
This issue can also be reproduced in this Plotly Python example. Please let me know if I should open a separate issue on plotly.py.

Thank you for your time and for making Plotly so awesome!

@archmoj archmoj added the bug something broken label Jun 30, 2020
@archmoj
Copy link
Contributor

archmoj commented Jun 30, 2020

@HunterMcGushion thanks for the report.

@ArtOshchepkov
Copy link

Is there any workaround?

@Yook74
Copy link

Yook74 commented Sep 17, 2020

The modebar is removed when switching from any type of 3D plot to any kind of 2D plot, but not vice-versa.

I have not tested every possible combination of 3D and 2D plot types, but I have (programmatically) checked all combinations of
bar, scatter, heatmap, scatter3d, surface, and mesh3d. The modebar is removed only when switching from a 3D type to a 2D type.

When I say that the modebar is "removed," I mean that its contents are no longer present in the DOM. The modebar-container div is there, but it has no contents. I've looked into the relevant code a little and it looks like when switching between 2D and 3D, makePlotFramework is called. This clears the modebar-container div. When going from 2D to 3D, the div is then filled in again, but for some reason it is not populated when switching from 3D to 2D.

The modebar will remain missing as long as one calls react, restyle etc. The modebar will show up again when newPlot is called or until the config parameter displayModeBar is set to false and then true again.

@ArtOshchepkov the last paragraph details the only workaround I know of. Just call newPlot instead of restyle. This does not work for me though, since I'm using Dash and do not have direct control over the Plotly API calls, so a fix would be appreciated!

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

Successfully merging a pull request may close this issue.

4 participants