- https://www.mathworks.com/matlabcentral/answers/489486-link-axes-with-different-y-scales
- https://www.mathworks.com/matlabcentral/answers/335430-plot-order-with-two-y-axes
- https://www.mathworks.com/matlabcentral/answers/1603690-how-to-change-the-order-of-plots
- https://www.mathworks.com/matlabcentral/answers/855500-uistack-giving-error-with-yyaxis (this thread)
- https://www.mathworks.com/matlabcentral/answers/280015-draw-stack-order-for-yyaxis
- https://www.mathworks.com/matlabcentral/answers/1661295-how-to-set-front-and-back-lines-on-plot-with-yyaxis-left-and-right
Uistack giving error with yyaxis
16 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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 Center および File Exchange で Two y-axis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!