Remove data in figure after plot
이전 댓글 표시
I have the following situation, and I would like to select only some of that curves. Is there a manner?

댓글 수: 3
This methods assume you know the order of lines plotted and you know which lines (by number) you want to delete -
x = 0:0.01:10;
%5 curves
y1 = 10*sin(x);
y2 = 10*cos(x);
y3 = 0*x+10;
y4 = x.^2;
y5 = 10*(sin(x)-cos(x));
%plotting the curves
figure
plot(x,y1,x,y2,x,y3,x,y4,x,y5)
%Find line objects
h = findobj('type','line');
%The list returns the lines in the reverse order
%So (i)th line drawn corresponds to the (n(total number of lines)- i + 1) th
%element of h
delete(h(6-[2 5]))
Gabriele Curcio
2023년 6월 8일
Dyuman Joshi
2023년 6월 9일
What exactly do you mean by that?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


