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

Skip to content

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
Use Path.contains_point instead of nxutils function.
`nxutils` is removed from master.
  • Loading branch information
tonysyu committed Mar 12, 2012
commit fe3e2b870a6a2634e5267115f83c3500c6372e15
7 changes: 4 additions & 3 deletions examples/widgets/lasso_selector_demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

from matplotlib.widgets import LassoSelector
from matplotlib.nxutils import points_inside_poly
from matplotlib.path import Path


class SelectFromCollection(object):
Expand Down Expand Up @@ -45,7 +45,8 @@ def __init__(self, ax, collection, alpha_other=0.3):
self.ind = []

def onselect(self, verts):
self.ind = np.nonzero(points_inside_poly(self.xys, verts))[0]
path = Path(verts)
self.ind = np.nonzero([path.contains_point(xy) for xy in self.xys])[0]
self.fc[:, -1] = self.alpha_other
self.fc[self.ind, -1] = 1
self.collection.set_facecolors(self.fc)
Expand Down Expand Up @@ -76,6 +77,6 @@ def disconnect(self):
print selector.xys[selector.ind]
selector.disconnect()

# Block end of script so you can check that lasso is disconnected.
# Block end of script so you can check that the lasso is disconnected.
raw_input('Press any key to quit')