Skip to content

Commit 6915dce

Browse files
committed
FIX: Ensure contiguous inputs to points_in_polygon (#410)
1 parent 0bfc04a commit 6915dce

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

chaco/polygon_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def hittest(self, screen_pt, threshold=7.0, return_distance=False):
134134
data_pt = self.map_data(screen_pt, all_values=True)
135135
index = self.index.get_data()
136136
value = self.value.get_data()
137-
poly = np.vstack((index,value)).T
137+
poly = np.column_stack((index, value))
138138
if points_in_polygon([data_pt], poly)[0] == 1:
139139
return True
140140
else:

chaco/tools/lasso_selection.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
# Major library imports
44
import numpy
5-
from numpy import array, empty, sometrue, vstack, zeros, ascontiguousarray
5+
from numpy import array, column_stack, empty, sometrue, vstack, zeros
66

77
# Enthought library imports
88
from traits.api import Any, Array, Enum, Event, Bool, Instance, \
@@ -308,9 +308,8 @@ def _map_data(self, point):
308308
def _get_data(self):
309309
""" Returns the datapoints in the plot, as an Nx2 array of (x,y).
310310
"""
311-
points = array((self.plot.index.get_data(),
312-
self.plot.value.get_data()))
313-
return ascontiguousarray(points.T)
311+
return column_stack((self.plot.index.get_data(),
312+
self.plot.value.get_data()))
314313

315314
#------------------------------------------------------------------------
316315
# Property getter/setters

0 commit comments

Comments
 (0)