anntzer / mplcursors

Interactive data selection cursors for Matplotlib.
https://mplcursors.readthedocs.io
zlib License
113 stars 19 forks source link

Is it possible to get Hovering to work without picking a line? #76

Closed Kushtulk closed 5 months ago

Kushtulk commented 5 months ago

If I want the line with the tooltip to show I have to put the cursors on one of the data lines (see screenshot). Is it possible to get it to show without being on a line, just based on X-value?

scooter

anntzer commented 5 months ago

I don't think it is particularly easy to tweak mplcursors to get that behavior (I don't really think it matches mplcursors' design either, as I explicitly don't assume that line plots have x as independent variable and y as dependent variable). You're more likely to get there by adapting the code at https://matplotlib.org/stable/gallery/event_handling/cursor_demo.html#snapping-to-data-points (for example).