擅长:python、mysql、java
<p>我相信<a href="https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.quiver.html" rel="nofollow noreferrer">quiver</a><a href="https://matplotlib.org/examples/pylab_examples/quiver_demo.html" rel="nofollow noreferrer">as in this example</a>适合你的情况。
你只需要定义向量,而不是矩阵。
遵循示例代码:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
from numpy import ma
X=np.arange(0, 2 * np.pi, .2)
Y=np.ones(X.shape)
U= np.cos(X)
V= np.sin(X)
plt.figure()
plt.plot(X,X,' ')
Q = plt.quiver(X, Y, Y, Y, units='width')
Q = plt.quiver(X, Y-2, U, V, units='width')
plt.show()
</code></pre>
<p>这就产生了这个结果</p>
<p><a href="https://i.stack.imgur.com/Eu5s6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eu5s6.png" alt="Quivers"/></a></p>