How to add constant line y(50) to all plots of stackedplot?
조회 수: 16 (최근 30일)
이전 댓글 표시
Hi all,
I am using stackedplot with 15 columns in a time table. How can I add a constant line of y(50) to all those 15 graphs in the stacked plot?
Thanks
댓글 수: 0
채택된 답변
Adam Danz
2021년 5월 21일
You can get the axis handles in stackedplot using the undocumented NodeChildren property. Then add the constant line object to each y-axis. Since yline only accepts one axis handle you can do it in a loop or use arrayfun as I have, below.
rng('default')
h = stackedplot(rand(100,5).*10+45);
ax = findobj(h.NodeChildren, 'Type','Axes');
arrayfun(@(axh)yline(axh,50,'m-','LineWidth',1),ax);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!