0

I am plotting a 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 with infinite length - no matter how much I extend the axes (the parameter lim) The arrows' head is not seen :

lim = 10 enter image description here

lim = 100 enter image description here

What am I doing wrong?

Thanks!

4

1 回答 1

2

在 quiver 命令中使用“scale”参数:

quiver(X,Y, U, V, scale=20.0)
于 2013-08-13T13:09:36.530 回答