How can I get CurrentPoint to display the coordinates within a figures axes rather than the coordinates of the whole figure itself.
조회 수: 18 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (2개)
Simon Thalén
2015년 6월 19일
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
William Chamberlain
2018년 4월 12일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!