Home > front end >  Same length of vectors using quiver for wind direction representation
Same length of vectors using quiver for wind direction representation

Time:07-16

I have a code like

import matplotlib.pyplot as plt
import numpy as np
U= np.array([-2.99, -3.12, -4.18, -4.45, -3.36, -4.66, -3.93, -2.53, -4.6 ,
       -4.71, -3.64, -2.81, -2.5 , -3.35, -3.24])
V= np.array([-6.33, -6.25, -6.54, -7.48, -6.27, -6.48, -5.69, -5.81, -8.81,
       -8.48, -6.86, -6.95, -5.8 , -5.9 , -4.39])
X=np.arange(0, len(U))
plt.figure()
plt.quiver(X,2,U,V)
plt.ylim([1.5,2.5])
plt.show()

enter image description here The figure generated from the code is attached. Here, I am looking for the arrows with equal lengths keeping the same wind direction. I also need to reduce the thickness of the arrows. Please help me.

CodePudding user response:

You can pass constant values for U and V to make all arrows the same length and specify the angles explicitly. The arrow thickness can be adjusted with the width parameter. See the docs for enter image description here

  • Related