Skip to content

Commit

Permalink
Merge pull request #5289 from anntzer/cursor_demo-IndexError
Browse files Browse the repository at this point in the history
Fix IndexError in cursor_demo.py.
  • Loading branch information
mdboom committed Oct 22, 2015
2 parents 8379d78 + 8ad4f33 commit b791d76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/pylab_examples/cursor_demo.py
Expand Up @@ -60,7 +60,7 @@ def mouse_move(self, event):

x, y = event.xdata, event.ydata

indx = np.searchsorted(self.x, [x])[0]
indx = min(np.searchsorted(self.x, [x])[0], len(self.x) - 1)
x = self.x[indx]
y = self.y[indx]
# update the line positions
Expand Down

0 comments on commit b791d76

Please sign in to comment.