%% Default Aspect Ratio Selection
% The axes Position property specifies the location and dimensions of the axes within the figure. The third and fourth elements of the Position vector (width and height) define a rectangle in which MATLAB draws the axes. MATLAB fits the axes to this rectangle.
% The default value for the axes Units property is normalized to the parent figure dimensions. This means the shape of the figure window determines the shape of the position rectangle. As you change the size of the figure window, MATLAB reshapes the position rectangle to fit it.

sphere
f = gcf;
ax = gca;
set(f,'Color',[0.90 0.90 0.90])
set(ax,'BoxStyle','full','Box','on')

%
% Changing the size and shape of the figure causes a change in the size and shape of the axes. The axes might select new axis tick mark locations as well.

f.Position(3) = f.Position(3) * 0.67;

% Reshaping the axes to fit into the figure window can change the aspect ratio of the graph. MATLAB fits the axes to fill the position rectangle and in the process can distort the shape. This is generally desirable for graphs of numeric data, but not for displaying objects realistically.
% Copyright 2019 The MathWorks, Inc.