ax2 = subplot(2,1,2)
ax2 =
Axes with properties:
XLim: [0 1]
YLim: [0 1]
XScale: 'linear'
YScale: 'linear'
GridLineStyle: '-'
Position: [0.1300 0.1100 0.7750 0.3412]
Units: 'normalized'
Show
all properties
ax2 = subplot(2,1,2)
ax2 =
Axes with properties:
XLim: [0 1]
YLim: [0 1]
XScale: 'linear'
YScale: 'linear'
GridLineStyle: '-'
Position: [0.1300 0.1100 0.7750 0.3412]
Units: 'normalized'
Show
all properties
ax2.OuterPosition(2) = ax2.OuterPosition(2)*2;
Notice how the bottom plot is closer to the upper plot in the second figure.
OuterPosition uses the standard MATLAB conventions: it is a vector of four values, where the first value is the x coordinate of the bottom of the position; the second value is the y coordinate of the left of the position; the third coordinate is the width; the fourth coordinate is the height.
The default (at least for this use) is "normalized" units -- units that are a fraction of the size of the container. In this particular example the container is a figure(), but if you had happened to use uipanel() then the normalized coordinates would be relative to the containing panel.
It is common to switch the Units of an axes to Pixels; if that is done before changing the OuterPosition, then the OuterPosition would report back in that new units and adjustments would be relative to that new Units.