How to add constant line y(50) to all plots of stackedplot?
16 views (last 30 days)
Adam Danz on 21 May 2021
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.
h = stackedplot(rand(100,5).*10+45);
ax = findobj(h.NodeChildren, 'Type','Axes');