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

2 visualizaciones (últimos 30 días)
Staffan Lindahl
Staffan Lindahl el 12 de Dic. de 2013
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

Respuestas (1)

neil jerome
neil jerome el 7 de Ag. de 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) ')']);

Categorías

Más información sobre Line Plots 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!

Translated by