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

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: