How to select a pixel on a figure and display linked data?
显示 更早的评论
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..
回答(2 个)
Image Analyst
2013-4-24
Why can't you just use plot()?
plot(x1, y1, 'r+');
hold on;
plot(x2, y1, 'g+');
1 个评论
Image Analyst
2013-4-24
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
2013-4-24
0 个投票
1 个评论
Image Analyst
2013-4-24
编辑:Image Analyst
2013-4-24
Is this an answer? I think it should have been a comment to me rather than an answer to your original question.
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!