How to assign yyaxis 'Label' and 'Range' to UIAxes in matlab appdesigner (R2020a)

조회 수: 53 (최근 30일)
i was try to assign third axis for app.UIAxes in matlab appdesinger, i tried
app.UIAxes.ZAxis = zlabel
but didnt worked...!!!
kindly suggest a Solution.

채택된 답변

Adam Danz
Adam Danz 2020년 10월 17일
편집: Adam Danz 2020년 10월 17일
The z axis is the 3rd dimension but your plot is 2D.
You yyaxis to assign an independent label to the right y-axis. Then link the two yaxes so that if properties of one change, the other axis will remain identical.
Demo:
% Create a demo uiaxes
app.UIAxes = uiaxes();
% Define right axis label
yyaxis(app.UIAxes, 'right')
ylabel(app.UIAxes, 'Right Side Label')
% Set axis colors to match the x axis color
set(app.UIAxes.YAxis, 'Color', app.UIAxes.XAxis.Color)
% Go back to the left y-axis and assign ylabel
yyaxis(app.UIAxes, 'left')
ylabel(app.UIAxes, 'Left Side Label')
% [DO ALL PLOTTING HERE]; Demo:
plot(app.UIAxes, randi(100,1,20), randi(50, 1,20), 'o')
% After plotting is done, link the y axes
% Link yaxis properties
app.UIAxes.UserData = linkprop(app.UIAxes.YAxis,...
{'Limits','LimitsMode','TickValues','TickLabelFormat','Scale',...
'Color','FontSize'}); %add more as needed
Result:
  댓글 수: 2
taimour sadiq
taimour sadiq 2020년 10월 17일
편집: taimour sadiq 2020년 10월 17일
Dear Adam Much thanks for Correcting my question, which i was not able to explain properly. U picked the right words for my Question... yes zaxis is used for 3d plot. i actually wants yyaxix on opposite side of plot which should remain fixed as u also Described.
Adam Danz
Adam Danz 2020년 10월 17일
Sounds good. Two critical things to remember:
  • Use yyaxis(app.UIAxes, 'left') or yyaxis(app.UIAxes, 'right') to control which side you're working with.
  • Place the app.UIAxes.UserData = linkprop... line after doing the plotting.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by