I have tried to search for the answer but have not found anything useful so forgive me if this has been answered before.
I want to change the linestyle of a regular plot to an arrow, in the direction of the data in the tuple. So in this script below I would like an arrow head pointing to the next marker.
There does not seem to be a line style to do it, but is there a way I can add the head at the correct end of the line?
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
labels=(‘91’,‘92’,‘93’,‘94’,‘95’)
data1 = (2500, 3000, 3500, 3000, 2700)
data2 = (200, 250, 270, 320, 250)
fig = plt.figure()
ax = fig.add_subplot(111)
p = ax.plot(data1, data2, ‘bo’, linestyle=’-’, markersize=3)
ax.set_ylim(0, 350)
for i, label in enumerate(labels):
x_loc = data1[i]
y_loc = data2[i]
txt = ax.annotate(label, xy=(x_loc, y_loc), size=8,
xytext=(-10, 10), textcoords=‘offset points’,
arrowprops=None)
plt.show()
Catherine