Wednesday 15 June 2011

python - Streamplot not working outside of the mgrid example -



python - Streamplot not working outside of the mgrid example -

i have 128x128 vector field want utilize plot streamlines in python. have 2 arrays coordinates, x1 , x2, , 2 arrays vector components, b1 , b2. when naively plug these streamplot, i.e.

plt.streamplot(x1, x2, b1, b2, color='k', linewidth=2)

i nondescriptive error concludes as

/usr/lib/pymodules/python2.7/matplotlib/streamplot.pyc in __init__(self, x, y) 252 if len(x.shape) == 2: 253 x_row = x[0] --> 254 assert np.allclose(x_row, x) 255 x = x_row 256 else: assertionerror:

i can create streamplot if build coordinate variables mgrid, in illustration (bounds modified here)

y, x = np.mgrid[x1[0][0]:x1[127][0]:128j, x2[0][0]:x2[0][127]:128j]

however, seems either flip x , y axes when making plot or cause errors similar above if seek right problem switching around inputs in streamplot(). also, able utilize streamplot non-uniform coordinates think preclude utilize of mgrid. help appreciated.

python numpy matplotlib

No comments:

Post a Comment