How to get a plot handle by ginput

4 ビュー (過去 30 日間)
S H
S H 2019 年 3 月 23 日
回答済み: Walter Roberson 2019 年 3 月 23 日
Would you please tell me what should be added to the following code in order to get one of the plot handles ah, bh or ch if the mouse is clicked on the corresponding plot?
figure
ah=plot(10:-1:-10);
hold on
bh=plot(-5:0.5:5);
ch=plot(-3:0.25:4);
[x,y]=ginput(1);
.....

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 23 日
What should be added is ButtonDownFcn callbacks on ah, bh, ch .
Otherwise you have to do a bunch of work figuring out which line segment is closest to where you clicked, and deciding whether you are within tolerance of it.

その他の回答 (0 件)

カテゴリ

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