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

Skip to content

Commit a2228be

Browse files
committed
Add strictly increasing check, corresponding doc fix
1 parent bff206e commit a2228be

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/matplotlib/streamplot.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
2525
2626
Parameters
2727
----------
28-
x, y : 1D arrays
29-
An evenly spaced grid.
28+
x, y : 1D/2D arrays
29+
Evenly spaced strictly increasing arrays to make a grid.
3030
u, v : 2D arrays
3131
*x* and *y*-velocities. The number of rows and columns must match
3232
the length of *y* and *x*, respectively.
@@ -333,6 +333,11 @@ def __init__(self, x, y):
333333
else:
334334
raise ValueError("'y' can have at maximum 2 dimensions")
335335

336+
if not (np.diff(x) > 0).all():
337+
raise ValueError("'x' must be strictly increasing")
338+
if not (np.diff(y) > 0).all():
339+
raise ValueError("'y' must be strictly increasing")
340+
336341
self.nx = len(x)
337342
self.ny = len(y)
338343

0 commit comments

Comments
 (0)