Skip to content

Commit 0d7a1d1

Browse files
committed
Catch divide-by-zero in step calculation
1 parent 4bbd671 commit 0d7a1d1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/streamplot.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ def _integrate_rk12(x0, y0, dmap, f):
450450
stotal += ds
451451

452452
# recalculate stepsize based on step error
453-
ds = min(maxds, 0.85 * ds * (maxerror/error)**0.5)
453+
if error == 0:
454+
ds = maxds
455+
else:
456+
ds = min(maxds, 0.85 * ds * (maxerror/error)**0.5)
454457

455458
return stotal, xf_traj, yf_traj
456459

0 commit comments

Comments
 (0)