Zoom tools from Toolbar does not work properly on every axes, Matlab GUI.

Hi guys,
I edit a GUI with some Toolbar Tools like zoom in, zoom out, ect.. I work with three different axes which are totally overlapped, so I control their visibility using the set(handles.'axes_tag','Visible','on/off') command.
I have some problems to use tools because they don't works on each axes: in fact, I have two axes with off visibility and one visible but the tools consider the first two and not the last one. I also tried to set zoom on/off for the target axes using zoom(handle.axes_tag,'on/off') command but it seems to haven't any effect.
Can someone explain me what am I wrong or the cause of this behaviour?
Thanks for attention,
Fabio

5 Comments

I'm not totally clear what setup you have, but setting the 'Visible' property of an axes just switches off the box and ticks, it won't make the whole axes and its children invisible. Any image or anything else plotted on the axes will remain visible.
Hi Adam,
you are right! In fact I use the "cla(handles.axes_tag,'reset')" command to clean graph from plots. However the problem persists..
Is it possible to assign the zoom tool at a particular axes referring to its handle tag?
Fabio
I show you this picture to better understand the GUI disposition. The three axes are the two small subplots and the big axes in the back. After some plots, cla and set operations that involve all the axes the zoom works only on subplot1 and 2..
I have the same problem. I have two layers so that I can easily toggle back and forth between two figure "views". One layer is underneath and invisible. The active one is visible. But Matlab is confused when I use the zoom tool in one of the visible axes I think. I think Matlab is registering that the mouse is hovering over an invisible axes, and so it does not zoom in/out when I release the mouse button after drawing the rectangle. What we need is a way for Matlab to scan multiple axes that are overlaid, and only zoom into the top most one if it is visible.
Kris
Can't you just switch the order of the axes when you make one invisible too?

Sign in to comment.

 Accepted Answer

Sending in the axes control to each tool, like cla or zoom, should work. If it doesn't then try to set the default axes before with the axes command:
axes(handles.subplot1); % Set current axes to the desired one.
zoom(3); % Use zoom with no handles.
See if that works.
Or you can use a scroll panel. See attached demo.

More Answers (1)

Use the setAllowAxesZoom method of the zoom mode object to control which axes are allowed to zoom and which are not.

1 Comment

This solution works great, it also works for setAllowAxesPan. We have to set other axes off and set current axes on to make it work. Thanks for the neat solution!

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!