Can you update the state just to change a map plot layout?

I would like to toggle between “open-street-map” and “satellite” in my map plot layout view, is there a way just to change the layout from the Scattermapbox plot?

In my first callback, I do a SQL query make data frame then plot a map.

fig_map.update_layout(mapbox_style="satellite", mapbox_accesstoken=map_token)

If I have to redo the whole callback should I store my SQL query in a cache instead?

you can’t update just the layout right now, but we’d like to make it possible to update sub properties.

until then, your backend could provide the figure to a store, and then you could have a clientside callback that merges your layout change with the figure in the store to update a graph. that’ll save a round trip.

What kind of plots are you making? What you are asking is supported in Dash Leaflet, but it Dash Leaflet does not have all the plotting capabilities of Plotly figures.

I’m making a Densitymapbox and also inserting Scattermapbox on the same figure. I’ll have a look at Dash Leaflet haven’t been exposed to it.

The Dash Leaflet component supports plotting circles (and markers with arbitrary icons), which should suffice to create a scatter plot. However, there is currently no support for density plots, so it might not suit your need after all :confused:

@chriddyp, using a store and a client-side callback makes sense. What is not as clear to me is what your target Output would be. Given that you need to access the Graph object’s layout property, don’t you need to specify the Graph object as an output twice? Once with whatever trigger generates the data, and a second time for the mapbox style update which will be handled on the client side. My understanding is that the plotly’s architecture does not allow the same output target multiple times which is why you support the context global to determine the input source? Thanks