8000 Merge pull request #21899 from meeseeksmachine/auto-backport-of-pr-21… · matplotlib/matplotlib@0d36f3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d36f3f

Browse files
authored
Merge pull request #21899 from meeseeksmachine/auto-backport-of-pr-21859-on-v3.5.x
Backport PR #21859 on branch v3.5.x (Fix streamline plotting from upper edges of grid)
2 parents 7faefdd + f996859 commit 0d36f3f

File tree

5 files changed

+11
-1498
lines changed

5 files changed

+11
-1498
lines changed

lib/matplotlib/streamplot.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
171171

172172
for xs, ys in sp2:
173173
xg, yg = dmap.data2grid(xs, ys)
174+
# Floating point issues can cause xg, yg to be slightly out of
175+
# bounds for xs, ys on the upper boundaries. Because we have
176+
# already checked that the starting points are within the original
177+
# grid, clip the xg, yg to the grid to work around this issue
178+
xg = np.clip(xg, 0, grid.nx - 1)
179+
yg = np.clip(yg, 0, grid.ny - 1)
180+
174181
t = integrate(xg, yg)
175182
< 69F1 span class=pl-k>if t is not None:
176183
trajectories.append(t)
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0