How to Turn off th yyaxis mode in app designer?
5 views (last 30 days)
Show older comments
in the code followed below, when I switch off, I expect the second y axis delete. But it remains.
cla(app.UIAxes,"reset") is useless because The lables will be cleared.
what is your suggestion?
methods (Access = private)
function [] = ploot(app)
a=[1,2,3,4];
b=2*a;
c=2*b;
plot(app.UIAxes,a,b);
yyaxis(app.UIAxes,'right');
plot(app.UIAxes,a,c);
end
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Switch
function SwitchValueChanged(app, event)
value = app.Switch.Value;
switch value
case 'On'
ploot(app);
case 'Off'
cla(app.UIAxes);
end
0 Comments
Accepted Answer
M Afshari
on 18 Aug 2022
1 Comment
dpb
on 18 Aug 2022
TMW has pretty-much locked down the axes object with the yyaxis stuff so you can't get at as much -- there are two x-axis object handles; one would think one should be able to close/delete one of those, and it would go away, but no!, nothing happens when try that.
I've wished for similar functionality on occasion before, as well; seems like there should be a definable way to revert back to a single axes; whether just left or right.
I've stuck with plotyy on occasion for similar reasons; one still has both axes objects that can mung on to heart's content including deleting one without losing the other. There are warts in keeping the two in synch on occasion that the yyaxis object doesn't have, but it can come with a price as well.
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming 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!