How to clear only a part of the plot

181 次查看(过去 30 天)
Hi! I have a figure with multi lines plotted in different steps. plot(a); hold on; plot(b); plot(c); plot(d);
I want to clear only the some of the plots and hold the rest.
delete plot(a) and plot(c)
cfl will remove all. Any solution to this? thanks.

采纳的回答

KSSV
KSSV 2018-7-26
figure
hold on
h1 = plot(rand(10,1)) ;
h2 = plot(rand(10,1)) ;
h3 = plot(rand(10,1)) ;
h4 = plot(rand(10,1)) ;
set(h2,'Visible','off')
set(h4,'Visible','off')
  1 个评论
Stephen23
Stephen23 2018-7-26
编辑:Stephen23 2018-7-26
This does not clear them from the plot, just makes the lines not visible.

请先登录,再进行评论。

更多回答(1 个)

Stephen23
Stephen23 2018-7-26
编辑:Stephen23 2018-7-26
This will actually delete the line objects from the axes:
ah = plot(...);
hold on
bh = plot(...);
ch = plot(...);
delete(ah)
delete(ch)

类别

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