8000 Fix streamline plotting from upper edges of grid by dstansby · Pull Request #21859 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix streamline plotting from upper edges of grid #21859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

10000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,

for xs, ys in sp2:
xg, yg = dmap.data2grid(xs, ys)
# Floating point issues can cause xg, yg to be slightly out of
# bounds for xs, ys on the upper boundaries. Because we have
# already checked that the starting points are within the original
# grid, clip the xg, yg to the grid to work around this issue
xg = np.clip(xg, 0, grid.nx - 1)
yg = np.clip(yg, 0, grid.ny - 1)

t = integrate(xg, yg)
if t is not None:
trajectories.append(t)
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0