How can I extract the x and y coordinates when hovering over a "heatmap"?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 13 de Abr. de 2020
Respondida: MathWorks Support Team
el 27 de Abr. de 2020
I am using a "heatmap" object and I would like to be able to select one cell and be able to get the position of it, through code, not only by reading it from the dataTips window. Is there a property or a callback which allows me to do that?
Respuesta aceptada
MathWorks Support Team
el 13 de Abr. de 2020
As of MATLAB R2019b, this is not possible. Other objects such as "imagesc" allow the exact functionality that you require. In fact, you can use their "ButtonDownFcn" method to extract the coordinates of the point where you click in the figure. Therefore, as a workaround, you could use the following script to create an image object which looks like a "heatmap" and extract the position of the mouse:
d = magic(5);
im = imagesc(d);
[x,y] = meshgrid(1:5);
labels = num2str(d(:));
text(x(:),y(:),labels);
im.ButtonDownFcn = @(s,e) disp(e)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!