Skip to content

Commit f996859

Browse files
QuLogicmeeseeksmachine
authored andcommitted
Backport PR #21859: Fix streamline plotting from upper edges of grid
1 parent 7faefdd commit f996859

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
if t is not None:
176183
trajectories.append(t)
Binary file not shown.
21.2 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy