When trying to add non-default modebar buttons using modeBarButtonsToAdd, following error appears: ‘must provide button ‘name’ in button config error occurs’ yet correct name have been used according to docs?
Dash Version: 1.9 (these buttons are updated in Dash version 1.12
Docs for buttons in Dash framework: dcc.Graph config options https://github.com/plotly/plotly.js/blob/master/src/components/modebar/buttons.js
import plotly.express as px
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
#simple image
img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]],
[[0, 255, 0], [0, 0, 255], [255, 0, 0]]
], dtype=np.uint8)
fig = px.imshow(img_rgb)
#config
config = {'displaylogo': False, 'modeBarButtonsToAdd': ['drawclosedpath', 'eraseshape'],}
#Dash application with graph
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(figure=fig, config=config)
])
app.run_server(debug=True, use_reloader=False)
modeBarButtonsToAdd doesn't appear to be working as intended similar issue but only seems to work with default modebar buttons
Any help would be appreciated, thankyou.
1 post - 1 participant