这个quiver的构造方法还挺蛋疼的,很多时候我们想要点对点的箭头,下面提供一种快速获得点到点箭头的方法
import matplotlib.pyplot as plt
实例:
dx = x2 - x1
dy = y2 - y1
plt.quiver(x1, y1, dx, dy, angles='xy', scale=1, scale_units='xy')
plt.quiver(X, Y, U, V, angles='xy', scale=1, scale_units='xy')
参数解释:
X : 箭头(向量)起点x坐标
Y : 箭头(向量)起点y坐标
U : 箭头终点坐标为 X+U
V : 箭头终点坐标为 Y+V
注意,这样点到点的箭头,需要将
scale 参数设置为 1
scale_units 参数设置为 'xy'
示例
我们还可以基于点到点的箭头,输入点坐标,画出按照x,y排序的点的序列,这些序列的箭头指向下一个点