Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Lasso selector #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 17, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove call to new_axes in SpanSelector.
* This change is in preparation for generalizing the base Widget.
* It's not clear to me why `new_axes` is necessary, but I left it in (for now).
  • Loading branch information
tonysyu committed Feb 27, 2012
commit 5b35427c4a0e977af8f6dd31c7661ba42deb1dbe
22 changes: 19 additions & 3 deletions 22 lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
assert direction in ['horizontal', 'vertical'], 'Must choose horizontal or vertical for direction'
self.direction = direction

self.ax = None
self.canvas = None
self.ax = ax
self.canvas = ax.figure.canvas
self.visible = True
self.cids=[]

Expand All @@ -958,8 +958,24 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
self.buttonDown = False
self.prev = (0, 0)

self.new_axes(ax)
self.cids.append(self.canvas.mpl_connect('motion_notify_event', self.onmove))
self.cids.append(self.canvas.mpl_connect('button_press_event', self.press))
self.cids.append(self.canvas.mpl_connect('button_release_event', self.release))
self.cids.append(self.canvas.mpl_connect('draw_event', self.update_background))

if self.direction == 'horizontal':
trans = blended_transform_factory(self.ax.transData, self.ax.transAxes)
w,h = 0,1
else:
trans = blended_transform_factory(self.ax.transAxes, self.ax.transData)
w,h = 1,0
self.rect = Rectangle( (0,0), w, h,
transform=trans,
visible=False,
**self.rectprops
)

if not self.useblit: self.ax.add_patch(self.rect)

def new_axes(self,ax):
self.ax = ax
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.