Here's my problem: I have an axes object in a figure. The user can draw a bunch of points on the image. Up to this point, everything is working as it should.
Now the user shall be able to zoom, draw some points on the zoomed image, and revert back to the original image once he/she has done.
I have a function updateVisualization that is called every time there is a change on the axes made by the user.
In this function, I tried to use
zoom(h, 'reset');
imagesc(updated_img);
zoom(h, 'out');
This solution keeps the zoom every the user does a modification :-) however, once the user is done, he/she cannot go back to the original zoom level.
What should I do?
% Saving zoom level
xlim = get(handles.axes, 'XLim');
ylim = get(handles.axes, 'YLim');
% Displaying image
imagesc(im, 'Parent', handles.axes, 'ButtonDownFcn', @axes_ButtonDownFcn);
% Setting saved zoom level.
set(handles.axes, 'XLim', xlim);
set(handles.axes, 'YLim', ylim);