Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUG: Fix streamplot when velocity component is exactly zero.

  • Loading branch information...
commit 5639974b67ab7e677cfbf12cb70b28a0e1b58cc3 1 parent 2c91aa6
@tonysyu authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/matplotlib/streamplot.py
View
10 lib/matplotlib/streamplot.py
@@ -461,14 +461,14 @@ def _euler_step(xf_traj, yf_traj, dmap, f):
xi = xf_traj[-1]
yi = yf_traj[-1]
cx, cy = f(xi, yi)
- if cx > 0:
- dsx = (nx - 1 - xi) / cx
- else:
+ if cx < 0:
dsx = xi / -cx
- if cy > 0:
- dsy = (ny - 1 - yi) / cy
else:
+ dsx = (nx - 1 - xi) / cx
+ if cy < 0:
dsy = yi / -cy
+ else:
+ dsy = (ny - 1 - yi) / cy
ds = min(dsx, dsy)
xf_traj.append(xi + cx*ds)
yf_traj.append(yi + cy*ds)
Please sign in to comment.
Something went wrong with that request. Please try again.