I need to plot a vector field with the quiver function in matplotlib. I have the X,Y coordinates and the FX, FY vector components saved as individual lists. With this data, I'm able to determine the corresponding unit vectors:
import numpy as np
FXUN=[]
FYUN=[]
def norma(compx,compy):
magnitud= np.sqrt(compx**2 + compy**2)
return magnitud
for vec in range(len(FX)):
magnitud=np.sqrt(FX[vec]**2 + FY[vec]**2)
FXUN.append(FX[vec]/magnitud)
FYUN.append(FY[vec]/magnitud)
In the above code, the FX and FY lists contain the unormalized vector components, whereas the FXUN and FYUN contain the normalized ones. How can I plot the unit vectors field but with a colorbar indicating their magnitude? (without normalization) Thanks