Skip to content

modeBarButtonsToAdd doesn’t appear to be working as intended #2981

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

Open
gsmaio opened this issue Dec 16, 2020 · 0 comments
Open

modeBarButtonsToAdd doesn’t appear to be working as intended #2981

gsmaio opened this issue Dec 16, 2020 · 0 comments
Labels
bug something broken P3 backlog

Comments

@gsmaio
Copy link

gsmaio commented Dec 16, 2020

Using "modeBarButtonsToAdd" to add buttons for interactive annotations and shape drawing in plotly figures, it prevents the HTML plot to be shown at all with plotly.offline rendering!

import plotly.offline as offline
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x='petal_width', y='sepal_length', color='species')
fig.update_layout(
    dragmode='drawopenpath',
    newshape_line_color='cyan',
    title_text='Draw a path to separate versicolor and virginica'
)

config = dict({'scrollZoom': True,'displaylogo': False, 'modeBarButtonsToAdd':['drawline','drawopenpath','drawcircle','drawrect','eraseshape']}) 

offline.plot(fig,  
                     auto_open=True, image = None, config =config, 
                     filename='./foo.html', include_plotlyjs='directory')

If the 'modeBarButtonsToAdd':[ ] is emptied, the HTML is correctly rendered again. Any idea with this weird behaviour?
Please, see also https://eoss-image-processing.github.io/2020/05/06/shape-drawing.html

Environment:
Python 3.7
Plotly 4.14.1
dash 1.18.1

@gvwilson gvwilson self-assigned this Jun 24, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants