필터 지우기
필터 지우기

how to make subplot visible off along with the ploted line?

조회 수: 20 (최근 30일)
Deepak siddappa gopalappa
Deepak siddappa gopalappa 2014년 8월 22일
답변: Geoff Hayes 2014년 8월 23일
hello
I am using set(handle,'Visible','off') to make visibility of the subplot to off but its not working for the line which is already plot in the axes

답변 (1개)

Geoff Hayes
Geoff Hayes 2014년 8월 23일
Deepak - by calling set(handle,'Visible','off'), you are setting the visibility of the graphics object associated with handle to off and not its "children" which are the graphics drawn within the subplot axes. For example, if we were to draw the sine curve on two subplots as
x=-2*pi:0.0001:2*pi;
y=sin(x);
figure;
h1 = subplot(2,1,1);
plot(h1,x,y,'r');
h2 = subplot(2,1,2);
plot(h2,x,y,'b');
hold(h2,'on');
plot(h2,x,y+0.5,'g');
Now, like you, we try to hide the second subplot as
set(h2,'Visible','off');
and as you observed, the lines/plots drawn within the second subplot (the blue and green curves) are still visible. To set them invisible, like their parent subplot, we do
set(get(h2,'Children'),'Visible','off');
Now both the subplot and its children are invisible.
Try the above and see what happens!

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by