フィルターのクリア

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 Center および File ExchangeSubplots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by