Join GitHub today
toolbar.update() breaks history #9974
I'm looking for resetting the zoom and pan history of interactve browsing. Using
Code for reproduction
Run this code in python a console:
from matplotlib import pyplot as plt f = plt.figure() plt.plot([1, 2, 5]) plt.show(block=False) f.canvas.toolbar._views._elements # One element f.canvas.toolbar._positions._elements # One element f.canvas.toolbar.update() f.canvas.toolbar._views._elements # Empty ! f.canvas.toolbar._positions._elements # Empty ! # Zoom once # Try to go back using the home button or back arrow
The view doesn't change when pressing home button or back arrow
I expect to be able to got back to the state the plot was in when
Are you able to check this in Master? The behaviour here changed a fair bit to the point that
Right now what happens is
Out of curiousity, why are you calling
If I understand correctly the behavior will be wrong if zoom or pan were already pressed before
I will try to check with master but I don't think I will find the time soon.
In my case the matplotlib widget is embedded in a Qt application where some parameters can change. In that case the plot is redrawn and the view is reset, and the previous history has to be cleared so that the Home button sets the view to a useful state.