Matlab-like Cursor Mode

Hi All,

Something I use a lot in Matlab is probing points from a plot, basically
clicking to select the nearest point and show a tooltip with the x and y
values. I didn't manage to reproduce this exactly with matplotlib, but I
found the code from the link below which is close enough to what I need:

Is there a better way, or something along those lines is the best option?

Thanks in advance,