python - Why does pyplot.quiver plots vectors with infinite length? -
i plotting 5x10 matrix of vectors using pyplot.quiver :
from pylab import * column_resolution = 10 row_resolution = 5 plotborders = 2 x,y = meshgrid(arange(column_resolution),arange(row_resolution)) # x,y positions of vectors u = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0] v = [0, 0, 0, 0, -1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] lim = 10 xlim(-1*lim,lim) ylim(-1*lim,lim) quiver(x,y, u, v) show()
the resulting figure has vectors infinite length - no matter how extend axes (the parameter lim) arrows' head not seen :
lim = 10
lim = 100
what doing wrong?
thanks!
use "scale" parameter in quiver command:
quiver(x,y, u, v, scale=20.0)
Comments
Post a Comment