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

Dash Reset Axes range not updating if ranges specified in Layout

If the figure in a Dash Graph is updated via callback and the new figure has ranges specified for the x and y axes the Reset Axes tool will reset the axes to those from the original figure. If no ranges are specified in the new figure Layout, Reset Axes will reset the axes to values appropriate for the new figure.

See https://pastebin.com/rPEFzTTC for my contrived example. If you select Log Plot from the dropdown menu then click the Reset Axes button the y axis range is set to 10 to 10^500. If you remove the range=yrange from the yaxis definition in the layout, Reset Axes behaves as expected in the Log Plot.

Is there some way to have Reset Axes use the ranges specified in the Layout when updating a figure? Setting uirevision to a changing value in the layout did not work.

Thanks

Hi,

I am having the same problem and I was able to figure out a hacky workaround. Have you (or anyone else) found a proper solution for this problem?

My solution consists of having the callback update both the figure (from a dcc.Graph component) as well as the children of a html.Div to [dcc.Store(id=“store”, data=figure)] and then taking the store as another input for the callback updating the figure. If the trigger for the callback was this store, simply return its data as the figure and [dcc.Store(id=“store”, data=None)] as the children of the html.Div. If the data of the store was None, raise PreventUpdate.
This is definitely very hacky however…