Text curvature along a line is not easy to do with matplotlib, but annotatewill allow you to easily mark a line with text and an arrow.
eg.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 20, 200)
y = np.cos(x) + 0.5 * np.sin(3 * x)
fig, ax = plt.subplots()
ax.plot(x, y)
ax.annotate(r'$y = cos(x) + \frac{sin(3x)}{2}$', xy=(x[70], y[70]),
xytext=(20, 10), textcoords='offset points', va='center',
arrowprops=dict(arrowstyle='->'))
plt.show()

source
share