bring to front in dual plot
17 views (last 30 days)
Show older comments
In dual plot, how to bring the left plot to front, I try uistack but didn't work
9 Comments
dpb
on 24 Jul 2025
Edited: dpb
on 25 Jul 2025
@Adam Danz says "changing the child order can be a strategy for controling stacking order in general. "
Yeah, I learned about that from there having been a blog illustrating it at some distant time in the past; couldn't begin to say who or when, any more.
Your demo illustrates the point I made earlier about there being only one child/axes rather than multiple so that there isn't anything to sort/rearrange to affect stacking order.
My only thought was whether if one could apply the same concept to the axes order instead of lines it might just trigger a refresh of both axes.
dpb
on 26 Jul 2025
Edited: dpb
on 26 Jul 2025
yyaxis right
plot(1:5)
yyaxis left
plot(5:-1:1)
hAx=gca
hAx.YAxis
hAx.YAxis(1)==hAx.YAxis(2)
yyaxis is a special beastie, indeed; being one axes but with two selectable independent NumericRuler Y-axes.
For comparison, the venerable plotyy
x=1:5;
hAx=plotyy(x,flip(x),x,x)
hAx==gca
creates two completely independent axes, overlaying the second on top of the first.
Either way, there's no convenient way to change the stacking order; while one can
hAx=flip(hAx);
hAx==gca
and indeed, change the storage order ot the two axes since now the handle array is just a graphics object array like any other, that has no effect on the existing stacking order.
PS. I'm not sure what the warning is about; that doesn't happen locally, but I'm still with R2021b/R2022b here.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




