how to make subplot visible off along with the ploted line?
20 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Geoff Hayes
on 23 Aug 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!
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!