How can i find the position of the origin of a Cartesian plot?
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
neil jerome
on 7 Aug 2019
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) ')']);
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!