Get drawable axis position after axis equal

13 次查看(过去 30 天)
Say I run this simple test:
figure;
axis;
axis equal;
Then you resize it a little, and run this
disp(gca.Position)
The answer will always be
ans =
0.1300 0.1100 0.7750 0.8150
which means the Position array will always stay the same, but the drawable (white) area of the axes object will always be resized to fit as much as possible inside that Position array.
The thing is that I want the actual position of the upper-right corner of the drawable area axes object. In this image, I want the position of the green point, not the red point to which I could arrive simply using Position.

采纳的回答

Jan
Jan 2017-11-20
编辑:Jan 2017-11-20
See https://www.mathworks.com/matlabcentral/answers/5882-getting-the-axis-position-correctly : The properties TightInset and PlotBoxAspectRatio matter. Before you can interpret them, the axes' units must be set to pixels:
figure
h = axes
axis equal
pause(5); % Change the figure size
h.Units = 'pixels';
disp(h.TightInset)
disp(h.PlotBoxAspectRatio)
disp(h.Position)
h.Units = normalized;
This should help you to find the solution. Unfortunately I cannot provide a working code yet.
  1 个评论
Nautilus
Nautilus 2017-11-21
Thanks for the help. It will still take some more math to get to the final result, but still it was a great help. Thank you.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by