Black Lives Matter. Please consider donating to Black Girls Code today.

Updating Mapbox Style Dynamically?

I’m trying to update my map style with values from a dropdown menu (streets,satellite,open-street-map)

The following callback doesn’t update the figure with the new style. Am I missing something?

# Callback for timeseries price
@app.callback(Output('the-map', 'figure'),
              [Input('mapstyle', 'value')])
def update_graph(selected_dropdown_value):
    mapbox_access_token = g_key
    print(selected_dropdown_value)
    data = [go.Scattermapbox()]
    layout = go.Layout(
                       mapbox=dict(
                           center=dict(lat=g_center_lat, lon=g_center_lon),
                           accesstoken=mapbox_access_token,
                           zoom=2,
                           style=selected_dropdown_value
                       ))
    fig = go.Figure(data=data,
                    layout=layout)
    return fig

I figured it out. It started working correctly when I removed animate=True from the graph object.