I am new to python, I have came across an issue.
To visualize a vector field i am reading x,y,u,v
cordinates and it's displacements. Using matplotlib quiver. Now the colouring i want to be based on the length of arrow but it's random now and doesn't make much sense. I went through some stakckoverflow posts and this is what i have added so far.
color_array = np.sqrt(((x[skip]-n)/2)**2 + ((y[skip]-n)/2)**2)
python code
import numpy as np
import matplotlib.pyplot as plt
x,y,z,u,v,w = np.loadtxt(
'file.txt',
unpack=True
)
n = -2
color_arr = np.sqrt(((x-n)/2)**2 + ((y-n)/2)**2)
plt.quiver(x,y,u,v,
color_arr,
scale=5)
plt.show()