I'm trying to plot some arrows using matploblib with the quiver function. But I want to choose the length of each arrow individually using an array.
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html
In these demos and documentation, it is show that you can change scales proportionally to units (x,y, width, height, xy, inches, ...), is there a way to define a scale for each arrow?
To specify each arrow's location and vector and length is an over-specification of the quiver plot. So what you need to do is change the data that you are plotting.
If you have the vector field U and V (same U and V as your examples), you can normalize them by:
N = numpy.sqrt(U**2+V**2) # there may be a faster numpy "normalize" function
U2, V2 = U/N, V/N
Then you can apply whatever scaling factor array you want:
U2 *= F
V2 *= F
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With