Stacking order of figures

29 Ansichten (letzte 30 Tage)
the cyclist
the cyclist am 18 Nov. 2014
Bearbeitet: men8th am 8 Feb. 2023
Suppose I create three figures
for ni = 1:3
figure
plot(rand(7))
drawnow
end
These will be drawn with Figure 1 on the bottom, Figure 2 in the middle, and Figure 3 on top, remaining viewable at the end.
How can change the stacking order? Prior to 2014b, one could sort the Children of the root object numerically, but I can't figure out how to do it in 2014b.

Antworten (1)

Doug Hull
Doug Hull am 18 Nov. 2014
Maybe I am misunderstanding the question:
close all
for ni = 1:3
figure
plot(rand(7))
drawnow
end
uistack(2,'top')
uistack(1,'top')
  4 Kommentare
the cyclist
the cyclist am 19 Nov. 2014
Yes, that seems to work. Thanks!
men8th
men8th am 8 Feb. 2023
Bearbeitet: men8th am 8 Feb. 2023
An explicit version of the above command, which doesn't rely on casting a figure handle to double returning the figure number is:
set(groot,'Children',sort([get(groot,'Children').Number]))
This also uses groot to point to the graphics root object, rather than the magic number 0.
From reading the documentation, This will only find and re-order figures with visible handles. To work with all figures, you need to use findall.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by