Reputation: 51
I would like to plot y vs x line, then on top of it I would like to plot vectors. I can do this using plot
and quiver
functions of matplotlib. However, the vectors will always be drawn behind the line, not on top. That is the line will be visible over the vector arrows.
My question for all of you is... is there a way to put the quiver vectors on top of the previously plotted line?
Upvotes: 5
Views: 3801
Reputation: 87566
You need to set the zorder
of the quiver to be higher than the line.
x = range(15)
y = rand(15)
u = rand(15)
v = rand(15)
figure()
plot(x,y,'rx-',zorder=0)
quiver(x,y,u,v,zorder=1)
Upvotes: 9