From 36146893e6e079f3ac52e54d12985d8102fb06bc Mon Sep 17 00:00:00 2001 From: einarr Date: Fri, 4 Apr 2014 19:16:59 +0000 Subject: [PATCH] Fixed selections. points_inside_poly is deprecated, and all calls are therefore rewritten to use Path.contains_points. --- laydi/plots.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/laydi/plots.py b/laydi/plots.py index 8789d82..2fc3452 100644 --- a/laydi/plots.py +++ b/laydi/plots.py @@ -4,7 +4,6 @@ import gtk import matplotlib from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg -from matplotlib.nxutils import points_inside_poly from matplotlib.figure import Figure from matplotlib.collections import LineCollection from matplotlib.patches import Polygon,Rectangle,Circle @@ -334,7 +333,7 @@ class ScatterMarkerPlot(Plot): def lasso_select_callback(self, verts, key=None): 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.update_selection(ids, key) self.selection_listener(self.current_dim, ids) @@ -608,7 +607,8 @@ class ScatterPlot(Plot): def lasso_select_callback(self, verts, key=None): 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.update_selection(ids, key) self.selection_listener(self.current_dim, ids) @@ -719,7 +719,7 @@ class HistogramPlot(Plot): if self.current_dim == None: return self.active_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) if not self.active_patches: return ids = set() @@ -902,7 +902,7 @@ class NetworkPlot(Plot): def lasso_select_callback(self, verts, key=None): 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.update_selection(ids, key) self.selection_listener(self.current_dim, ids)