How to select a pixel on a figure and display linked data?
1 view (last 30 days)
Show older comments
Starting from a matrix which contains only -1,0,+1 values, i compute distances between every positive point to 'tau' nearest negative ones. After i create an array of structures of this type:
mystruct(i).coord= [x y] % coordinates of positive point
mystruct(i).nearest= [x y] % where x and y are column vectors representing x and %y coordinates of 'tau' nearest points
mystruct(i).dist= d %d is a column vector with corresponding distance between i and one of tau nearest points.
Now, i want to display in a Figure the original matrix marking in different colors (ex red and blue)positive and negative points with the possibility of selecting one or more positives and showing marking with another color (ex green) the corresponding nearest neighbours. I guess i'll have to use a callback function associating it to ButtonDownFcn but i'm not so used to graphic function. Is there someone who can give me an help or just some links to better understand the procedure? Thanks in advance..
0 Comments
Answers (2)
Image Analyst
on 24 Apr 2013
Why can't you just use plot()?
plot(x1, y1, 'r+');
hold on;
plot(x2, y1, 'g+');
1 Comment
Image Analyst
on 24 Apr 2013
Responding to your "Answer" below... Can you upload a screenshot of your desired appearance so we can see what you'd like? Mock up something in Photoshop if you have to.
Giaime Origgi
on 24 Apr 2013
1 Comment
Image Analyst
on 24 Apr 2013
Edited: Image Analyst
on 24 Apr 2013
Is this an answer? I think it should have been a comment to me rather than an answer to your original question.
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!