changing YLabel position and outerposition
Ältere Kommentare anzeigen
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 Kommentar
Adam Danz
am 5 Jun. 2020
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

Akzeptierte Antwort
Weitere Antworten (4)
Eugene Paymurzov
am 5 Jun. 2020
Bearbeitet: Eugene Paymurzov
am 5 Jun. 2020
0 Stimmen
1 Kommentar
Adam Danz
am 5 Jun. 2020
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
am 5 Jun. 2020
0 Stimmen
Eugene Paymurzov
am 5 Jun. 2020
0 Stimmen
4 Kommentare
Adam Danz
am 5 Jun. 2020
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
am 5 Jun. 2020
Eugene Paymurzov
am 8 Jun. 2020
Eugene Paymurzov
am 8 Jun. 2020
0 Stimmen
1 Kommentar
Adam Danz
am 8 Jun. 2020
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.
Kategorien
Mehr zu Geographic Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






