How to clear a particular figure and replace it with other

조회 수: 6 (최근 30일)
Yash Phirke
Yash Phirke 2021년 5월 5일
댓글: Yash Phirke 2021년 5월 6일
So I have got a curve f in green which I want to keep as it is. I have plot a blue circle over it. Now I want to clear this blue circle by keeping the green curve as it is and plot a new red circle over it. How should I do it?
clf
hold on
fplot(f,'g')
xlim([-1,3])
ylim([-2,2])
p1 = plot(0,0,'bo');
clf(p1,'reset')
p2 = plot(0,1,'ro');

채택된 답변

VBBV
VBBV 2021년 5월 5일
편집: VBBV 2021년 5월 6일
%f true
clf
hold all
fplot(f,'g')
xlim([-1,3])
ylim([-2,2])
f1 = figure
plot(0,0,'bo');
clf(f1,'reset')
plot(0,1,'ro');
Reset using figure handles
  댓글 수: 2
VBBV
VBBV 2021년 5월 6일
편집: VBBV 2021년 5월 6일
%if true
hold on
fplot(x^3-3*x,'g')
xlim([-1,3])
ylim([-2,2])
p1 = plot(0,0,'bo');
p1.YData = []
p1.XData = [];
plot(0,1,'ro');
Try this one instead. Ignore previous one
Yash Phirke
Yash Phirke 2021년 5월 6일
Thank you very much!
This worked really great.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by