如何在使用
我目前正在使用以下代码:
我希望能够放置一个简单的图例,以一种简单的方式显示三个不同颜色的箭头。
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()