Skip to content

Commit fd2f284

Browse files
committed
Fix rounding error in calculating index
1 parent dc63626 commit fd2f284

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

astrowidgets/bqplot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ def _mouse_move(self, event_data):
407407
yc = event_data['domain']['y']
408408

409409
# get the array indices into the data so that we can get data values
410-
x_index = int(np.trunc(xc + 0.5))
411-
y_index = int(np.trunc(yc + 0.5))
410+
x_index = int(np.floor(xc + 0.5))
411+
y_index = int(np.floor(yc + 0.5))
412412

413413
# Check that the index is in the array.
414414
in_image = (self._data.shape[1] > x_index >= 0) and (self._data.shape[0] > y_index >= 0)

0 commit comments

Comments
 (0)