Python Forum

Full Version: Create multiple quiver plots 3D array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to create multiple (this can either be animated or navigated through using matplotlib tools) 2D quiver plots from 3D arrays.

My inputs are u and v which are large 3d Arrays with the same shape.

Any help would be amazing.

#Define x and y 
fig, quiv = plt.subplots(figsize=(8.2,6.4))
a = np.arange(0,u.shape[2],1)
b = np.arange(0,u.shape[1],1)
A , B = np.meshgrid(a,b)


#Plot the first frame 
Q = quiv.quiver(A,B,u[0,:,:],v[0,:,:])
quiv.xaxis.set_ticks([])
quiv.yaxis.set_ticks([])


#Not a clue from here on...
def update_quiver(i):
    Q.set_UVC(U[i, ...], V[i, ...])
    return Q

anim = animation.FuncAnimation(fig, update_quiver, fargs=(Q, A, B, i),interval=1, blit=False)

plt.show()