Get drawable axis position after axis equal

13 views (last 30 days)
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.

Accepted Answer

Jan
Jan on 20 Nov 2017
Edited: Jan on 20 Nov 2017
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 Comment
Nautilus
Nautilus on 21 Nov 2017
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!