Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 291c977

Browse files
committed
Remove extra index error checks
1 parent ed712e3 commit 291c977

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/matplotlib/image.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,10 +1197,7 @@ def get_cursor_data(self, event):
11971197
return None
11981198
j = np.searchsorted(self._Ax, x) - 1
11991199
i = np.searchsorted(self._Ay, y) - 1
1200-
try:
1201-
return self._A[i, j]
1202-
except IndexError:
1203-
return None
1200+
return self._A[i, j]
12041201

12051202

12061203
class PcolorImage(AxesImage):
@@ -1334,10 +1331,7 @@ def get_cursor_data(self, event):
13341331
return None
13351332
j = np.searchsorted(self._Ax, x) - 1
13361333
i = np.searchsorted(self._Ay, y) - 1
1337-
try:
1338-
return self._A[i, j]
1339-
except IndexError:
1340-
return None
1334+
return self._A[i, j]
13411335

13421336

13431337
class FigureImage(_ImageBase):

0 commit comments

Comments
 (0)