AxesToolBar is not Responding for two axes on top of each other.
    6 views (last 30 days)
  
       Show older comments
    
Hi,
I am trying to write a code in which a switch button changes the axes on a figure where each axes contains mesh. I am currently doing it by setting the Visible property of axes and its children to off in callback of switch button.  My code is below
f =figure;
uicontrol(f,'Style','pushbutton','String','Switch','Callback',@temp)
ax(1) = axes(f);
mesh(ax(1),rand(10,10),'Visible','off'),title('Plot 1')
ax(1).Visible = 'off';
ax(2) = axes(f);
mesh(ax(2),rand(10,10)),title('Plot 2')
function temp(obj,~)
ax = findobj(obj.Parent,'Type','Axes');
for i=1:length(ax)
    if(strcmp(ax(i).Visible,'on'))
        ax(i).Visible='off';
        ax(i).Children.Visible = 'off';
    else
         ax(i).Visible='on';
         ax(i).Children.Visible = 'on';
    end
end
end
Initial figure

After Switch is pressed

The problem i am encountering is with the axes Tool bar. For example i select rotate3d. when i rotate Plot 2 it works perfectly, but i try to rotate Plot 1 after switching it is not rotating. (Built in interactions of axes are working though).
Assuming ax(1) is Plot 1 and ax(2) is Plot 2, i tried to set toolbar visibility of ax(2) to off but it is still not working.
Regards,
M.SAAD
2 Comments
Answers (0)
See Also
Categories
				Find more on 2-D and 3-D Plots in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
