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

Skip to content

Commit a88f621

Browse files
committed
Fix bounds checking.
Checking that the coordinate less than the array Nx/Ny does not work when the coordinate is float (e.g. it can be between `Nx` and `Nx - 1`).
1 parent 0657e73 commit a88f621

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/matplotlib/streamplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def shape(self):
244244

245245
def valid_index(self, xi, yi):
246246
"""Return True if point is a valid index of grid."""
247-
return xi >= 0 and xi < self.nx and yi >= 0 and yi < self.ny
247+
return xi >= 0 and xi <= self.nx-1 and yi >= 0 and yi <= self.ny-1
248248

249249

250250
class StreamMask(object):

0 commit comments

Comments
 (0)