You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Navigation in the zoom stack using the Home, Forward, Backward buttons on the toolbar does not work after the figure is cleared with clf().
Code for reproduction
plt.plot([1,2,3])
plt.clf()
plt.plot([1,2,3])
# now click the Zoom button and try to zoom in/out on the figure. Then press Home, Forward or Back buttons on the navigation toolbar: nothing happens.
Actual outcome
The Home, Forward and Back buttons on the toolbar do not work: the zoom does not change as expected.
Expected outcome
Stepping forward and backward in the zoom stack should work as expected when pressing the navigation buttons.
Matplotlib version
Operating system: Linux 64
Matplotlib version: v2.0.2, v2.1.0
Matplotlib backend (print(matplotlib.get_backend())): tried Qt5 and Tk, possibly all others are affected
Python version: 3.6
Jupyter version (if applicable): -
Other libraries: -
I use conda, python3.6 and matplotlib (v2.0.2) from the default channel and matplotlib (v2.1.0) from conda-forge.
I have tried with the current HEAD (bdb8568), but the problem is still there. I have done a bit more extensive testing and found the following:
start with a simple plot (e.g. plt.plot([1,2,3]))
zoom in several times
"back" and "forward" work as expected, but "home" does not rewind the history stack as I would expect, just inserts another stack element at the current point with the original zoom state.
If you now plt.clf() and do another plot, the situation is different:
-- "back" and "forward" work as expected.
-- if you press "back" while at the first point of the stack, you can no more go "forward"
-- "home" does not work: nothing happens. The same zoom state remains, and "back" and "forward" no longer work.
Please let me know if and how I can help diagnosing.
I think 'home' in this context means "go to original view" not "fully rewind my history". Either does make sense, but the implementation is what it is so behavior 3 is probably not going to change (imaging the bug report of someone who has been using the current behavior).
Retesting this now (3.6.2) , plt.clf() clears the history as I think is correct and I stand by the behavior in step 3 being correct.
Closing this as it appears fixed to me. I did not bisect to sort out when we fixed it, but I suspect it was 2b0b376 (which resets the nav stack if the axes in the figure change).
Activity
tacaswell commentedon Nov 9, 2017
Can you try with master or 2.1.x? I think this is fixed by #9359
awacha commentedon Nov 9, 2017
Dear Thomas,
I have tried with the current HEAD (bdb8568), but the problem is still there. I have done a bit more extensive testing and found the following:
-- "back" and "forward" work as expected.
-- if you press "back" while at the first point of the stack, you can no more go "forward"
-- "home" does not work: nothing happens. The same zoom state remains, and "back" and "forward" no longer work.
Please let me know if and how I can help diagnosing.
tacaswell commentedon Nov 9, 2017
I think 'home' in this context means "go to original view" not "fully rewind my history". Either does make sense, but the implementation is what it is so behavior 3 is probably not going to change (imaging the bug report of someone who has been using the current behavior).
Behavior 4 sounds like a bug (or two) though.
tacaswell commentedon Nov 9, 2017
Bumped this to 2.2 because it is not a regression from 2.0
tacaswell commentedon Dec 4, 2022
Retesting this now (3.6.2) ,
plt.clf()clears the history as I think is correct and I stand by the behavior in step 3 being correct.Closing this as it appears fixed to me. I did not bisect to sort out when we fixed it, but I suspect it was 2b0b376 (which resets the nav stack if the axes in the figure change).