changing YLabel position and outerposition
显示 更早的评论
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];
1 个评论
Adam Danz
2020-6-5
https://www.mathworks.com/help/matlab/creating_plots/automatic-axes-resize.html are used ActivePositionProperty which is not recommended starting in R2020a
But I think ActivePositionProperty is similar PositionConstraint. I changed ActivePositionProperty to PositionConstraint but the problem didn't gone.
The description of PositionConstraint says:
Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:
- 'outerposition' — The OuterPosition property remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the InnerPosition property.
- 'innerposition' — The InnerPosition property remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the OuterPosition property.
So when I setup PositionConstraint to 'outerposition' I can change property Position of YLabel.
So matlab's help permit me to use my code but Matlab work invalid.
The below picture are shown the figure before changing position of YLabel. PositionConstraint set by 'outerposition' and Matlab work right.

The below picture are shown the figure after changing position of YLabel. PositionConstraint set by 'outerposition' and Matlab work invalid.

The below picture are shown the figure after changing position of YLabel if Matlab would be right

采纳的回答
更多回答(4 个)
Eugene Paymurzov
2020-6-5
编辑:Eugene Paymurzov
2020-6-5
0 个投票
1 个评论
Adam Danz
2020-6-5
Not all reported bugs are public.
To see a list of bugs you reported, go to your account page (requires that you're logged in).
Then click "Service Requests" under your profile avatar.
Eugene Paymurzov
2020-6-5
0 个投票
4 个评论
Adam Danz
2020-6-5
That's a standard practice in my field. All of my published figures are created in Matlab. Then I transfer the data to OriginLab and create vectorized plots but without labels. Then I transfer the OriginLab image to CorelDraw where I had the labels. It's a giant pain in the butt but it results in more flexibility.
Eugene Paymurzov
2020-6-5
Eugene Paymurzov
2020-6-8
Eugene Paymurzov
2020-6-8
0 个投票
1 个评论
Adam Danz
2020-6-8
My answer clearly explains the cause of the problem and it provides a solution. Your original question also continued to develop into other questions. The email you got is a reminder to accept answers that were helpful so you can think the volunteers who have give their time to you.
类别
在 帮助中心 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






