Skip to content

Fix streamplot for non-square grids. #789

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
Apr 16, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
import matplotlib
import matplotlib.patches as patches
import matplotlib.cbook as cbook


__all__ = ['streamplot']
Expand Down Expand Up @@ -332,9 +331,11 @@ def backward_time(xi, yi):
return -dxi, -dyi

def integrate(x0, y0):
"""Return x, y coordinates of trajectory based on starting point.
"""Return x, y grid-coordinates of trajectory based on starting point.

Integrate both forward and backward in time from starting point in
grid coordinates.

Integrate both forward and backward in time from starting point.
Integration is terminated when a trajectory reaches a domain boundary
or when it crosses into an already occupied cell in the StreamMask. The
resulting trajectory is None if it is shorter than `minlength`.
Expand Down Expand Up @@ -446,10 +447,10 @@ def _integrate_rk12(x0, y0, dmap, f):

def _euler_step(xf_traj, yf_traj, dmap, f):
"""Simple Euler integration step."""
nx, ny = dmap.grid.shape
ny, nx = dmap.grid.shape
xi = xf_traj[-1]
yi = yf_traj[-1]
cx, cy = f(xi, yi) # ds.cx is in data coordinates, ds in axis coord.
cx, cy = f(xi, yi)
if cx > 0:
dsx = (nx - 1 - xi) / cx
else:
Expand Down