Removing one of two plots on a single axis

1 回表示 (過去 30 日間)
Eli Roos
Eli Roos 2020 年 12 月 11 日
回答済み: Paul Hoffrichter 2020 年 12 月 11 日
Hey there,
I have created a figure with an interactive text box and a callback function that plots based on the user input.
I have an axis and i plotted a line on it once, but then later in my code i plot a red dot based on what the user inputs, but I need to be able to remove that red dot once the user inputs another number and create a red dot for that new number.
I can share my code but it's awfully long, I was also advised using findobj might work, or something with axes handle could work.

回答 (1 件)

Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 11 日
t =0:.01:1;
y = sin(2*pi*4*t); hold on;
h1 =plot(.2,.5,'ro');
pause
delete(h1)
Hit a spacebar and the red circle will disappear leaving the rest of the plot intact.

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by