필터 지우기
필터 지우기

Uistack giving error with yyaxis

조회 수: 26 (최근 30일)
Rohit Kumar
Rohit Kumar 2021년 6월 14일
편집: Adam Danz 2022년 3월 2일
I am getting an error when I am trying to move the line plotted on yyaxis (right) to the bottom, so that line plotted on y axis is on top. Below is the code to replicate the error. (Tried on 2019b)
figure
subplot(2,1,1)
yyaxis left
h1=plot(1:10,21:30,'r')
yyaxis right
h2=plot(1:10,rand(1,10),'b','linewidth',10)
subplot(2,1,2)
y=rand(1,10);
h3=plot(1:10,randi(10,1,10),'r')
hold on
h4=plot(1:10,randi(10,1,10),'b','linewidth',10)
uistack(h2,'bottom')
uistack(h4,'bottom')
uistack(h2,'bottom') - Throws an error
Error using matlab.graphics.axis.Axes/set
Children may only be set to a permutation of itself
Error in uistack (line 157)
set(UParent,'Children',AllChildren);
while uistack(h4,'bottom') works without an error & does the job of moving the line to bottom.
Kindly let me know if there is any workaround.
  댓글 수: 3
Rohit Kumar
Rohit Kumar 2021년 6월 14일
@Adam Danz Thanks for confirming & providing a workaround with plotyy. I will stick with yyaxis for now & will wait for uistack to work with yyaxis in a future release.
Appreciate your help..!
Adam Danz
Adam Danz 2021년 6월 14일
Good decision. Be prepared to wait for a while if this feature isn't high on the MW priority list. Another workaround would be to use an axis overlay (general advice on axis overlays) but still, yyaxis is more simpler.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by