Pyplot: adding point projections on axis

I can get a graph drawn using the plot function. But I would like to highlight some “special” points by having the projections drawn on the axes and putting text on both the point and the axes.

Something like this:

I tried with this:

import matplotlib.pyplot as plt

plt.plot(X, Y, label='data')  # draw curve, X and Y are arrays
plt.plot(Xp, Yp, c, duration), marker='o') # draw point @(Xp, Yp), Xp and Yp are scalars
plt.vlines(Xp, min(Y), Yp, linestyles='dashed')
plt.hlines(Yp, min(X), Xp, linestyles='dashed')

but what I get is not satisfactory:

What is the right way to get what I want?
I’ve also considered annotate, but it doesn’t seem to do what I need. Correct me if I’m wrong.

best regards

I would just us ax.axhline and ax.axvline instead. Placing the text on the axes is a bit trickier, but you can probably figure it out. You can get the current limits from ax.get_xlim. Or you can add an extra tick.