Colormap color levels on cursor
5 views (last 30 days)
Show older comments
I have a 3 column matrix which is x,y, and C. x and y values are coordinates and C value is intensity. I plot a diagram with using "patch" command.
On figure i just get x and y values on cursor. I want to see intenstiy values on colormap. How can i do it?
Note:
I have tried before meshgrid and countourf but it takes a lot of time to create figure because i have many data points. I use for loop for every rectangle so it takes a lot of time. When i do not use for loop it creates a wrong shape.
Anyone can help me?
3 Comments
Adam
on 17 Oct 2019
You can write your own Data cursor function
doc datacursormode
shows an example of this if you look for the UpdateFcn. It isn't necessarily trivial though. You'd likely have to use the axes' CurrentPoint property and work out which patch is currently under the mouse.
Alternatively I guess you could program your own functionality entirely using the ButtonDownFcn property of the patch objects (or of the axes objects if you can work out which patch is under the mouse. Doing tis on the axes though would require the patches to have their 'HitTest' set to off, otherwise the axes won't pick up mouse clicks under patches).
Accepted Answer
darova
on 17 Oct 2019
Here is direction
You have position of cursor in variable pos
You can access to FaceVertexCData with command
get(h,'FaceVertexCData')
You can access to XY data too:
get(h,'Vertices')
So all you have to do is to find some connection between all this data. Find index of pos in Vertices data and use it to display FaceVertexCData
12 Comments
More Answers (0)
See Also
Categories
Find more on Colormaps 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!