How to get a plot handle by ginput

1 Ansicht (letzte 30 Tage)
S H
S H am 23 Mär. 2019
Beantwortet: Walter Roberson am 23 Mär. 2019
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);
.....

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Mär. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Visual Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by