Supposing I have a np.array like that:
data = np.array([[1,2],[2,4],[3,5],[4,5]])
I want to plot the path from the first point to the second then from the second to the third etc... How can I manage that. I know how to link all the point but not with a specifies order.
import numpy as np
import matplotlib.pyplot as plt
data = np.array([[1,2],[2,4],[3,5],[4,5]])
plt.plot(data[:, 0], data[:, 1])
plt.show()
Alternatively, as suggested (this one by @fuglede is really nice):
plt.plot(*data.T)
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