AxesToolBar is not Responding for two axes on top of each other.

1 vue (au cours des 30 derniers jours)
Mehmed Saad
Mehmed Saad le 15 Mai 2020
Commenté : Mehmed Saad le 18 Mai 2020
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 commentaires
Walter Roberson
Walter Roberson le 18 Mai 2020
Try using uistack() to move the appropriate axes to 'top'
Mehmed Saad
Mehmed Saad le 18 Mai 2020
Thanks

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by