How can I get CurrentPoint to display the coordinates within a figures axes rather than the coordinates of the whole figure itself.
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rosie
el 8 de Ag. de 2012
Respondida: William Chamberlain
el 12 de Abr. de 2018
Hi Everyone,
I'm totally new to matlab so please bear with me.
I've created a GUI using GUIDE which converts and plots data from .BIN files (not important but just to give context) and I want to be able to view the cursors current position relative to the axes scale.
I've managed to get the cursor position relative to the figure window by using
new_point = get(handles.figure,'CurrentPoint');
set(handles.editbox,'String',new_point)
but since the axes don't have a 'CurrentPosition' nor a callback for 'WindowButtonMotionFcn' I can't seem to get values relative to my axes.
Is the only way to get around this to multiply the 'CurrentPosition' result (in my case 'new_point') by a vector equation which corresponds to the axes I've created, or is there another way to get around this?
In an ideal world I would be able to use DataCursor but unfortunately I'm using MATLAB version 6.1.
I'll be ever so grateful for any insight anyone could lend on this,
Thanks,
Rosie
0 comentarios
Respuesta aceptada
Más respuestas (2)
Simon Thalén
el 19 de Jun. de 2015
Im using get(handle,'CurrentPoint') within my own callback for buttonpress so i really don't want to use ginput..
I found out that when i replaced my handle for axes with simply gco it gave me the correct coordinates. I.E coordinates on the format of my axes if that makes any sense.
So for anyone having the same problem as Rosie try that
0 comentarios
William Chamberlain
el 12 de Abr. de 2018
gcf_currentpoint = get(gcf, 'CurrentPoint')
gives the pixel coordinates
axes_handle = gca
pt = get(axes_handle, 'CurrentPoint')
gives the relative position inside the axes (top right is 1,1 - bottom left is 0,0)
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!