Azzera filtri
Azzera filtri

How to define the order of layers/plots and axes?

103 visualizzazioni (ultimi 30 giorni)
I have some plots: p1 = plot(...); p2 = scatter(...). p3 = line(..); p4 = fill(...), p5 = imagesc(...); etc.
How to do the following?
1) Initialize these plots in arbitrary order, but not draw them yet!
2) Define the order of them, I mean: associate layers to them (top, bottom, etc.)
3) Draw them at the same time, with the above defined order (maybe set transparency also)
4) After plotting has been performed, is it possible to update a single layer and replot it, but with the appropriate untouched layers above it?
Note: And what if I have overlapping axes? Is it possible to associate layers to axes too?

Risposta accettata

Matt J
Matt J il 29 Mag 2023
Modificato: Matt J il 29 Mag 2023
1) Hfig=figure('Visible','off); p(1) = plot(...); p(2) = scatter(...). p(3) = line(..); p(4) = fill(...), p(5) = imagesc(...)
2) Use the Children property of the plot axes set(gca,'Children', p([2,5,4,3,1[)
3) Hfig.Visible='on'. For transparency, you can set the FaceAlpha and MarkerFaceAlpha properties of those p(i) that have them. Line plots do not, however.
4) Use the XData and YData properties of p(i)

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by