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

18 vues (au cours des 30 derniers jours)
Deepak siddappa gopalappa
Deepak siddappa gopalappa le 22 Août 2014
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

Réponses (1)

Geoff Hayes
Geoff Hayes le 23 Août 2014
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!

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by