Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2e5a04

Browse files
committed
Bugfix #1767997: Zoom to rectangle and home, previous, next buttons
The "original" position of the axes was not being saved/restored in the history stack. This patch saves both "original" and "active" position. svn path=/trunk/matplotlib/; revision=3789
1 parent 05bc909 commit d2e5a04

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/matplotlib/backend_bases.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,10 @@ def push_current(self):
14461446
xmin, xmax = a.get_xlim()
14471447
ymin, ymax = a.get_ylim()
14481448
lims.append( (xmin, xmax, ymin, ymax) )
1449-
pos.append( tuple( a.get_position() ) )
1449+
# Store both the original and modified positions
1450+
pos.append( (
1451+
tuple( a.get_position(True) ),
1452+
tuple( a.get_position() ) ) )
14501453
self._views.push(lims)
14511454
self._positions.push(pos)
14521455
self.set_history_buttons()
@@ -1660,7 +1663,9 @@ def _update_view(self):
16601663
xmin, xmax, ymin, ymax = lims[i]
16611664
a.set_xlim((xmin, xmax))
16621665
a.set_ylim((ymin, ymax))
1663-
a.set_position( pos[i] )
1666+
# Restore both the original and modified positions
1667+
a.set_position( pos[i][0], 'original' )
1668+
a.set_position( pos[i][1], 'active' )
16641669

16651670
self.draw()
16661671

0 commit comments

Comments
 (0)