Hello,
my problem is the following:
I want to plot an arrow-head onto the end of a line plot.
So far I have been able to devise the following solution, which I find
to be unsatisfactory. Minimal working example below.
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0.5, 1.0, 50)
y = x**2
fig = plt.figure(0)
ax = fig.add_subplot(111)
ax.plot(x[:-1], y[:-1], c='k')
ax.arrow(x[-2], y[-2], x[-1]-x[-2], y[-1]-y[-2], fc='k', ec='k)
plt.show()
But the thickness of the tail of the arrow and the thickness of the line
are not matching and I do not know which parameters I would need to tune
in order to get a visual appealing match.
I have looked into matplotlib.patches.FancyArrowPatch, but it was not
clear to me how I can use it to add the arrowhead to the line plot.
Unfortunately, I am not too familiar with the whole matplotlib
object-structure so that it is likely that I have overlooked something
that will make this relatively straightforward to achieve.
Any suggestions would be very helpful.
Thanks,
Benjamin