How can i find the position of the origin of a Cartesian plot?

조회 수: 5 (최근 30일)
Staffan Lindahl
Staffan Lindahl 2013년 12월 12일
I am trying to maintain the position of an 'edit box' in a resizeable GUI by the origin of a Cartesian plot. The position of the axes object is of course known.
How do I determine the location of the origin of the plot relative the position of the object? is there another way to find the position of the origin of the plot?
Thanks for any assistance

답변 (1개)

neil jerome
neil jerome 2019년 8월 7일
i would try looking at the 'position' property of the axes against the limits; the following works for figures, and seems to for axes in GUIs from a quick check...
hh = gca;
xRange = hh.XLim(2) - hh.XLim(1);
xFract = (0 - hh.XLim(1))/xRange;
xO = hh.Position(1) + xFract*hh.Position(3);
yRange = hh.YLim(2) - hh.YLim(1);
yFract = (0 - hh.YLim(1))/yRange;
yO = hh.Position(2) + yFract*hh.Position(4);
disp(['origin at (' num2str(xO) ',' num2str(yO) ')']);

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by