The following figure is created in a visualization software:

where I can attach a textbox label to a curve. Is there any way to achieve the same behavior in Python?
To possibly simplify things, the textbox doesn't have to be a particular location on the curve. I just needs to be close to or preferably on the curve.