필터 지우기
필터 지우기

How to Make All Children of a Figure Invisible?

조회 수: 20 (최근 30일)
Rightia Rollmann
Rightia Rollmann 2017년 3월 24일
댓글: Adam 2017년 3월 24일
Imagine I have a figure with three axes objects and a rectangle.
hfig = figure;
hax1 = axes;
hax2 = axes;
hax3 = axes;
hrec1 = rectangle;
How can I make the axes objects and the rectangle invisible, so only an empty figure is visible, and then again visible?

채택된 답변

Adam
Adam 2017년 3월 24일
편집: Adam 2017년 3월 24일
You could store them all in an array and then you can just use
set( hGraphics, 'Visible', 'off' )
Certainly your axes would be better as hAx(1), hAx(2), hAx(3) rather than 3 individual variables and you can tag a rectangle onto the same array too as it will just be an array of general graphics objects.
Recursively hunting through children can be a messy business although there may be functions that can do it, or something on file exchange.
A rectangle will be parented by an axes though so you can explicitly get children of your axes and hide them rather than starting at figure level.
  댓글 수: 2
Rightia Rollmann
Rightia Rollmann 2017년 3월 24일
And how can I create the array hGraphics?
Adam
Adam 2017년 3월 24일
hGraphics = [ hax1, hax2, hax3, hrec1 ];
Or preferably put them straight in the array as e.g.
hGraphics(1) = axes;
hGraphics(2) = axes;
...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by