10000 moving views and positions to tools · matplotlib/matplotlib@2c9a195 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c9a195

Browse files
committed
moving views and positions to tools
1 parent 022de6f commit 2c9a195

File tree

4 files changed

+157
-150
lines changed

4 files changed

+157
-150
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,10 +3252,6 @@ def __init__(self, manager):
32523252
self._idDrag = self.canvas.mpl_connect(
32533253
'motion_notify_event', self._mouse_move)
32543254

3255-
# a dict from axes index to a list of view limits
3256-
self.views = cbook.Stack()
3257-
self.positions = cbook.Stack() # stack of subplot positions
3258-
32593255
self._tools = {}
32603256
self._keys = {}
32613257
self._instances = {}
@@ -3522,12 +3518,6 @@ def get_tools(self):
35223518
'keymap': keys}
35233519
return d
35243520

3525-
def update(self):
3526-
"""Reset the axes stack"""
3527-
3528-
self.views.clear()
3529-
self.positions.clear()
3530-
35313521
def _mouse_move(self, event):
35323522
if not event.inaxes or not self._toggled:
35333523
if self._last_cursor != self._default_cursor:
@@ -3557,28 +3547,6 @@ def _mouse_move(self, event):
35573547
else:
35583548
self.toolbar.set_message('')
35593549

3560-
def draw(self):
3561-
"""Redraw the canvases, update the locators"""
3562-
3563-
for a in self.canvas.figure.get_axes():
3564-
xaxis = getattr(a, 'xaxis', None)
3565-
yaxis = getattr(a, 'yaxis', None)
3566-
zaxis = getattr(a, 'zaxis', None)
3567-
locators = []
3568-
if xaxis is not None:
3569-
locators.append(xaxis.get_major_locator())
3570-
locators.append(xaxis.get_minor_locator())
3571-
if yaxis is not None:
3572-
locators.append(yaxis.get_major_locator())
3573-
locators.append(yaxis.get_minor_locator())
3574-
if zaxis is not None:
3575-
locators.append(zaxis.get_major_locator())
3576-
locators.append(zaxis.get_minor_locator())
3577-
3578-
for loc in locators:
3579-
loc.refresh()
3580-
self.canvas.draw_idle()
3581-
35823550
def set_cursor(self, cursor):
35833551
"""
35843552
Set the current cursor to one of the :class:`Cursors`
@@ -3587,43 +3555,6 @@ def set_cursor(self, cursor):
35873555

35883556
pass
35893557

3590-
def update_view(self):
3591-
"""Update the viewlim and position from the view and
3592-
position stack for each axes
3593-
"""
3594-
3595-
lims = self.views()
3596-
if lims is None:
3597-
return
3598-
pos = self.positions()
3599-
if pos is None:
3600-
return
3601-
for i, a in enumerate(self.canvas.figure.get_axes()):
3602-
xmin, xmax, ymin, ymax = lims[i]
3603-
a.set_xlim((xmin, xmax))
3604-
a.set_ylim((ymin, ymax))
3605-
# Restore both the original and modified positions
3606-
a.set_position(pos[i][0], 'original')
3607-
a.set_position(pos[i][1], 'active')
3608-
3609-
self.canvas.draw_idle()
3610-
3611-
def push_current(self):
3612-
"""push the current view limits and position onto the stack"""
3613-
3614-
lims = []
3615-
pos = []
3616-
for a in self.canvas.figure.get_axes():
3617-
xmin, xmax = a.get_xlim()
3618-
ymin, ymax = a.get_ylim()
3619-
lims.append((xmin, xmax, ymin, ymax))
3620-
# Store both the original and modified positions
3621-
pos.append((
3622-
a.get_position(True).frozen(),
3623-
a.get_position().frozen()))
3624-
self.views.push(lims)
3625-
self.positions.push(pos)
3626-
36273558
def draw_rubberband(self, event, caller, x0, y0, x1, y1):
36283559
"""Draw a rectangle rubberband to indicate zoom limits
36293560

0 commit comments

Comments
 (0)
0