Is there a way to preserve zoom state of a choropleth between callbacks?
I am currently updating the choropleth via a callback function that generates a new figure and returning it to gcc.Graph. Replacing a whole figure should be easier than updating individual elements in an existing figure’s data and layout.
I tried to do the following:
- Track relayoutData when user zooms using State callback that’s linked to gcc.Graph.
- Generate a new choropleth.
- Change layout properties of new choropleth according to relayoutData.
- Return new choropleth with updated layout to gcc.Graph
I used fig['layout'].update(relayoutData)
to change the layout peroperties, but it didn’t work because of error
‘mapbox._derived’ is not a valid property for plotly.graph_objs.Layout
Any thoughts?