Plot many arrows in python

Viewed 2165

I have the following code:

import matplotlib.pyplot as plt

x = [0.1,0.2]
y = [0.3,0.4]
dx = [0.5,0.5]
dy = [0.5,0.3]

ax = plt.axes()
ax.arrow(x[0], y[0], dx[0], dy[0], head_width=0.09, head_length=0.1)
ax.arrow(x[1], y[1], dx[1], dy[1], head_width=0.09, head_length=0.1)
plt.show()

Now imagine that the dimension of x, y, dx, dy is a lot larger than 2, let's say 1000. It would be a pain to write 1000 lines by hand for each arrow.

Is there an automatic way to generate all the arrows, given I have the vectors x, y, dx, dy?

0 Answers
Related