MATLAB Answers

Getting mouse co-ordinates on an axis whilst zoomed

1 view (last 30 days)
Chris Atkin
Chris Atkin on 18 Mar 2012
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);
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.


Sign in to comment.

Answers (0)