Mpl_point_click: unable to place point after zooming

Please forgive my relative inexperience, as this may have an obvious answer.

I’m using mpl_point_click to get image XY positions after plotting with imshow. This works if I left-click right after plotting the image. However, I’m working with large images and I need to zoom in to be able to place my cursor precisely.

I’m using the QT backend, which allows me to zoom and pan, and to make the image take up the entire screen (these options don’t seem to be available for inline images). Once I zoom into the area of interest, left-clicking no longer results in the cursor position (“klicker.get_positions()” results in “”).

I’ve tried using the zoom available from mpl_interactions, but it’s much slower. I have hundreds of images to crank through so I need a process that is flexible and fast.

Am I missing something obvious? Thanks!

UPDATE: I figured it out. The zoom/pan buttons simply need to be deselected, and then I’m able to place points again. smacks forehead

Am I missing something obvious? Thanks! […] smacks forehead

I’m not actually sure that this is obvious so don’t beat yourself up too much about it! And nice job figuring it out :slight_smile:

I think I should put a line in the docs somewhere explaining this - @dunelady you’re currently the literal best person in the world to figure out how to explain what confused you (cured yourself of the confusion within the recent past) can you think of a short explanation that would have made it clear to you? I’d be really happy to include it in the docs to help all the other people who have this same issue.


Also, if you want panning and zooming that won’t interfere with the point clicker than you can use this library: mpl-pan-zoom — mpl-pan-zoom

Solutions often seem obvious in retrospect.

Hmm… how about something like:

“When plotting images on the QT backend, options such as zoom and pan are available as buttons on the plotting window. Note that mpl_point_click will not accumulate points while these options are selected, e.g., after zooming one must deselect the zoom button to either begin or continue placing points.”

Thanks for considering including this in the documentation.