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!






