Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Fixed selections. points_inside_poly is deprecated, and all calls are therefore

rewritten to use Path.contains_points.
This commit is contained in:
Einar Ryeng 2014-04-04 19:16:59 +00:00
parent 2b4da82165
commit 36146893e6
1 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,6 @@ import gtk
import matplotlib import matplotlib
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
from matplotlib.nxutils import points_inside_poly
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.collections import LineCollection from matplotlib.collections import LineCollection
from matplotlib.patches import Polygon,Rectangle,Circle from matplotlib.patches import Polygon,Rectangle,Circle
@ -334,7 +333,7 @@ class ScatterMarkerPlot(Plot):
def lasso_select_callback(self, verts, key=None): def lasso_select_callback(self, verts, key=None):
xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]] xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]]
index = scipy.nonzero(points_inside_poly(xys, verts))[0] index = scipy.nonzero(verts.contains_points(xys))
ids = self.dataset_1.get_identifiers(self.current_dim, index) ids = self.dataset_1.get_identifiers(self.current_dim, index)
ids = self.update_selection(ids, key) ids = self.update_selection(ids, key)
self.selection_listener(self.current_dim, ids) self.selection_listener(self.current_dim, ids)
@ -608,7 +607,8 @@ class ScatterPlot(Plot):
def lasso_select_callback(self, verts, key=None): def lasso_select_callback(self, verts, key=None):
xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]] xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]]
index = scipy.nonzero(points_inside_poly(xys, verts))[0] poly = matplotlib.path.Path(verts, closed=True)
index = scipy.nonzero(poly.contains_points(xys))[0]
ids = self.dataset_1.get_identifiers(self.current_dim, index) ids = self.dataset_1.get_identifiers(self.current_dim, index)
ids = self.update_selection(ids, key) ids = self.update_selection(ids, key)
self.selection_listener(self.current_dim, ids) self.selection_listener(self.current_dim, ids)
@ -719,7 +719,7 @@ class HistogramPlot(Plot):
if self.current_dim == None: return if self.current_dim == None: return
self.active_patches = [] self.active_patches = []
for patch in self.patches: for patch in self.patches:
if scipy.any(points_inside_poly(verts, patch.get_verts())): if scipy.any(verts.contains_points(patch.get_verts())):
self.active_patches.append(patch) self.active_patches.append(patch)
if not self.active_patches: return if not self.active_patches: return
ids = set() ids = set()
@ -902,7 +902,7 @@ class NetworkPlot(Plot):
def lasso_select_callback(self, verts, key=None): def lasso_select_callback(self, verts, key=None):
xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]] xys = scipy.c_[self.xaxis_data[:,scipy.newaxis], self.yaxis_data[:,scipy.newaxis]]
index = scipy.nonzero(points_inside_poly(xys, verts))[0] index = scipy.nonzero(verts.contains_ponts(xys))
ids = self.dataset.get_identifiers(self.current_dim, index) ids = self.dataset.get_identifiers(self.current_dim, index)
ids = self.update_selection(ids, key) ids = self.update_selection(ids, key)
self.selection_listener(self.current_dim, ids) self.selection_listener(self.current_dim, ids)