Info

This question is closed. Reopen it to edit or answer.

Getting mouse co-ordinates on an axis whilst zoomed

1 view (last 30 days)
Chris Atkin
Chris Atkin on 18 Mar 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
I'm trying to get the co-ordinates of the mouse cursor over an axis whilst the mouse is down. I have this so far:
set(axis_handle, 'buttondownfcn', @axisMouseDown);
function axisMouseDown(hObject, eventdata)
current_point = get(gca, 'currentpoint');
x = current_point(1);
y = current_point(1, 2);
do_things(x, y);
end
This does get the correct co-ordinates of the cursor, but it also zooms the axis out, which is something that I'd like to avoid.
More specifically, as soon as the axisMouseDown() is fired, the axis zooms out to its default zoom level.
Thanks in advance for your help.

Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!