If YLabel position change that outerposition mode of axes don't work for YLabel.
It's correct?
figure; ax1 = axes('OuterPosition',[0 0.50 1.0 0.50]);ax1.ActivePositionProperty = 'outerposition';plot(ax1,0:10,0:10);ax1.Title.String = 'Preserve OuterPosition';ax1.YLabel.Rotation = 0;ax1.YLabel.String = 'Preserve OuterPosition';ax1.YLabel.HorizontalAlignment = 'right';ax1.YLabel.VerticalAlignment = 'top';ax1.YLabel.Position(2) = ax1.YLabel.Position(2)+2; % outerposition mode of axes don't work for YLabel after the line
ax1.YLabel.HorizontalAlignment = 'right';ax1.YLabel.VerticalAlignment = 'top';outerpos = ax1.OuterPosition;ti = ax1.TightInset; left = outerpos(1) + ti(1);bottom = outerpos(2) + ti(2);ax_width = outerpos(3) - ti(1) - ti(3);ax_height = outerpos(4) - ti(2) - ti(4);ax1.Position = [left bottom ax_width ax_height];
Best Answer