Make an interactive plot which will allow you to draw a continuous line with 3 segments

3 ビュー (過去 30 日間)
nty huy
nty huy 2019 年 10 月 7 日
回答済み: Rik 2019 年 10 月 7 日
figure; hold on
xlim([0 1])
ylim([0 1])
plot(rand(1),rand(1),'o')
for i = 1 : 3
[x1 y1] = ginput( 1 );
plot( x1, y1, '+')
this is what i have but it only gives me dots not lines

回答 (1 件)

Rik
Rik 2019 年 10 月 7 日
You're only supplying single points to the plot function. If you want a line, you should first gather all the points and then call the plot function once.
Alternatively you can create a line object with plot and edit the XData and YData properties inside your loop.

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by