Reputation: 1745
How can I draw quivers in a matplotlib figure so that they are drawn over the original points.
soa = np.array([vec1,vec2])
X,Y,U,V = zip(*soa)
ax = plt.gca()
ax.plot(ax, rotdata[:,0], rotdata[:,1], 'o', c='b')
ax.quiver(X,Y,U,V, angles='xy', scale_units='xy',scale=1,
width=.02, color='r')
I get this with the code above.
This is the result I would like to have
Upvotes: 0
Views: 1110
Reputation: 2349
You need to specify an order for both the data points and the arrows by using the zorder kwarg as follows:
soa = np.array([vec1,vec2])
X,Y,U,V = zip(*soa)
ax = plt.gca()
ax.plot(ax, rotdata[:,0], rotdata[:,1], 'o', c='b', zorder=1)
ax.quiver(X,Y,U,V, angles='xy', scale_units='xy',scale=1,
width=.02, color='r',zorder=2)
Upvotes: 2