How to set YLim for multiple Yaxis on UIaxes
I am plotting a figure using uiaxes in app designer with 2 y axis one on the left and other on the right. And I am trying to set YLim for both left and right. But the code I wrote was wrong. The one I right for the right is overwriting the one on the left. So technically I am only setting YLim for the left one.
yyaxis(app.UIAxes_4,’left’);
plot(app.UIAxes_4,app.actualTime,app.Charge_Current);
app.UIAxes_4.XMinorGrid ="on";
app.UIAxes_4.YMinorGrid ="on";
app.UIAxes_4.YLabel.String = ‘Current [A]’;
app.UIAxes_4.YLabel.FontSize = 12;
app.UIAxes_4.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y1min app.Y1max]; % This sets the YLim correctly for the left side
yyaxis(app.UIAxes,’right’);
plot(app.UIAxes,app.actualTime,voltage);
app.UIAxes.XMinorGrid ="on";
app.UIAxes.YMinorGrid ="on";
app.UIAxes.YLabel.String = ‘Current [A]’;
app.UIAxes.YLabel.FontSize = 12;
app.UIAxes.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y2min app.Y2max]; % This overrides the Ylim set earlier and sets a new YLim for
% left side without setting
% Ylim for the right side.
What is the way to set Ylim on both left and right. Thank you.I am plotting a figure using uiaxes in app designer with 2 y axis one on the left and other on the right. And I am trying to set YLim for both left and right. But the code I wrote was wrong. The one I right for the right is overwriting the one on the left. So technically I am only setting YLim for the left one.
yyaxis(app.UIAxes_4,’left’);
plot(app.UIAxes_4,app.actualTime,app.Charge_Current);
app.UIAxes_4.XMinorGrid ="on";
app.UIAxes_4.YMinorGrid ="on";
app.UIAxes_4.YLabel.String = ‘Current [A]’;
app.UIAxes_4.YLabel.FontSize = 12;
app.UIAxes_4.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y1min app.Y1max]; % This sets the YLim correctly for the left side
yyaxis(app.UIAxes,’right’);
plot(app.UIAxes,app.actualTime,voltage);
app.UIAxes.XMinorGrid ="on";
app.UIAxes.YMinorGrid ="on";
app.UIAxes.YLabel.String = ‘Current [A]’;
app.UIAxes.YLabel.FontSize = 12;
app.UIAxes.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y2min app.Y2max]; % This overrides the Ylim set earlier and sets a new YLim for
% left side without setting
% Ylim for the right side.
What is the way to set Ylim on both left and right. Thank you. I am plotting a figure using uiaxes in app designer with 2 y axis one on the left and other on the right. And I am trying to set YLim for both left and right. But the code I wrote was wrong. The one I right for the right is overwriting the one on the left. So technically I am only setting YLim for the left one.
yyaxis(app.UIAxes_4,’left’);
plot(app.UIAxes_4,app.actualTime,app.Charge_Current);
app.UIAxes_4.XMinorGrid ="on";
app.UIAxes_4.YMinorGrid ="on";
app.UIAxes_4.YLabel.String = ‘Current [A]’;
app.UIAxes_4.YLabel.FontSize = 12;
app.UIAxes_4.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y1min app.Y1max]; % This sets the YLim correctly for the left side
yyaxis(app.UIAxes,’right’);
plot(app.UIAxes,app.actualTime,voltage);
app.UIAxes.XMinorGrid ="on";
app.UIAxes.YMinorGrid ="on";
app.UIAxes.YLabel.String = ‘Current [A]’;
app.UIAxes.YLabel.FontSize = 12;
app.UIAxes.YLabel.FontWeight ="bold";
app.UIAxes_4.YLim = [app.Y2min app.Y2max]; % This overrides the Ylim set earlier and sets a new YLim for
% left side without setting
% Ylim for the right side.
What is the way to set Ylim on both left and right. Thank you. matlab, appdesigner MATLAB Answers — New Questions