What I’m trying to do: I am building an interactive map with plotly and am trying to create a clean looking window with all buttons and dropdowns located on the plotly plot. I am wondering if it is possible to call a custom method either in Python on the client-side or in JS from a plotly button besides the “relayout”, “update”, “restyle”, “animate”, “and skip” methods available. Here is a link to the method call:
My goal is to use the button press to complete other tasks besides just updating the map layout on the page in a client side function.
Here is how the button currently calls the relayout function listed above:
self.plot_1.layout.updatemenus = list([
dict(
buttons=list([
dict(
args=['mapbox.style', 'dark'],
label='Dark Map View ',
method='relayout'
),
dict(
args=['mapbox.style', 'light'],
label='Light Map View ',
method='relayout'
),
dict(
args=['mapbox.style', 'satellite'],
label='Satellite Map View ',
method='relayout'
),
dict(
args=['mapbox.style', 'streets'],
label='Street Map View ',
method='relayout'
)
]),
bgcolor = '#FFFFFF',
font = dict(color='#000000'),
direction = 'down',
pad = {'r': 5, 't': 5, 'l':5, 'b':0},
showactive = True,
x = 0,
xanchor = 'left',
y = 1,
yanchor = 'top'
)
])
Thanks for any tips on figuring out how to call another function from one of these dropdowns or plotly buttons
Ethan