我正在使用pyplot.quiver绘制一个5X10的载体矩阵:
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()
得到的数字具有无限长度的向量 - 无论我多长时间延伸轴(参数 lim )都没有看到箭头的头部:
lim = 10
lim = 100
我做错了什么?
谢谢!
答案 0 :(得分:2)
使用quiver命令中的“scale”参数:
quiver(X,Y, U, V, scale=20.0)