如何放置使用pyplot.quiver
或pyplt.annotate
方法绘制的箭头图例?
我目前正在使用以下代码:
import matplotlib.pyplot as plt
from numpy.random import *
x, y = [1, 2, 3], [0.5, 0.5, 0.5]
u1,v1 = randn(3), randn(3)
u2,v2 = randn(3), randn(3)
u3,v3 = randn(3), randn(3)
QV1 = plt.quiver(x, y, u1, v1, color='r')
QV2 = plt.quiver(x, y, u2, v2, color='b')
QV3 = plt.quiver(x, y, u3, v3, color='g')
我想放一个简单的图例,它以一种简单的方式显示三种不同颜色的箭头,
plt.plot(x, y, color='r', label='red')
...
plt.legend()