I have an animated graph, where within a few frames, the points on the plot are above the range of the graph. I have one button that starts the animation, but at the same time that is running I would like to call the relayout method and have it autoscale the y-axis.
Is there a way to use one button to call multiple methods and do both together? Or are there other workarounds to having the layout change between frames? Thanks.
Hi @album,
Iโm not sure I understand what youโre trying to do. Are you trying to start with autorange off and then enable it for certain frames? If so, you might be able to add layout.yaxis.autorange=True to some of your frames.
Otherwise, could you add a full example that can be copied, pasted, and run?
Yes, thatโs exactly it. Iโd like to have the autorange change with each frame. When I tried updating the figure.layout.yaxis at the bottom of the for loop, it seemed to have just kept the values for the final iteration of the loop. How can I add it such that each frame sets the layout with its own autorange?
I found this post by @empet where each frame has a dictionary of a new calculated yaxis range. I tried to replicate this by testing with a range of [0, year] for the corresponding year of the frame, but it still does not seem to be updating between frames.