コード例 #1
0
 def callback(self, verts):
     if len(self.Nxy) > 1:
         for j, series in enumerate(self.y):
             # ind = pl.np.nonzero(points_inside_poly(zip(self.x, series), verts))[0]
             ind = pl.np.nonzero(mpl_path(verts).contains_points(zip(self.x, series)))[0]
             for i in range(self.Nxy[1]):
                 if i in ind:
                     self.badpoints.append([i, j, self.y[j, i]])
                     self.axes.collections[j]._offsets[i,1] = pl.nan
                     self.y[j,i] = pl.nan
     else:
         cleanedpoints = self.axes.collections[0]._paths[0].vertices.tolist()
         # ind = pl.np.nonzero(points_inside_poly(cleanedpoints, verts))[0]
         ind = pl.np.nonzero(mpl_path(verts).contains_points(cleanedpoints))[0]
         removedcount = 0
         for i in range(len(cleanedpoints)):
             if i in ind:
                 self.badpoints.append([i, self.x[i], self.y[i]])
                 out = cleanedpoints.pop(i - removedcount)
                 self.axes.collections[0]._paths[0].vertices = pl.asarray(cleanedpoints)
                 original_indx = pl.find(self.x == out[0])
                 self.y[original_indx] = pl.nan
                 removedcount += 1
     self.canvas.draw_idle()
     self.canvas.widgetlock.release(self.lasso)
     del self.lasso
コード例 #2
0
ファイル: ndviewer.py プロジェクト: Python3pkg/OpenElectrophy
def inside_poly(data, vertices):
    if (matplotlib.__version__ < '1.2'):
        return points_inside_poly(data, vertices)
    return mpl_path(vertices).contains_points(data)
コード例 #3
0
ファイル: ndscatter.py プロジェクト: xabiben/tridesclous
def inside_poly(data, vertices):
    return mpl_path(vertices).contains_points(data)
コード例 #4
0
def inside_poly(data, vertices):
    if(matplotlib.__version__ < '1.2'):
        return points_inside_poly(data, vertices)
    return mpl_path(vertices).contains_points(data)