How to rotate ylabel but still auto-resize plot axes?

5 ビュー (過去 30 日間)
Joe Lister-Symonds
Joe Lister-Symonds 2021 年 9 月 8 日
回答済み: Adam Danz 2023 年 3 月 17 日
I would like to orientate my ylabel horizontally as shown in the image, however the axes dont auto-resize when I do this causing the ylabel to overlap the ticklabels. How can I set the axes to auto-resize, and if I cant whats the best alternative?
I have been setting my figure size using the following code:
x0=1;
y0=1;
width=W;
height=W;
set(gcf,'units','inches')
set(gcf,'InnerPosition',[x0,y0,width,height])
And the ylabel orientation using:
ylabel('TEST [-]','FontSize',fo_axis,'rotation',0)
Many thanks, Joe

採用された回答

Matt J
Matt J 2021 年 9 月 8 日
ylabel('TEST [-]','FontSize',fo_axis,'rotation',0,'HorizontalAlignment','right')

その他の回答 (1 件)

Adam Danz
Adam Danz 2023 年 3 月 17 日
Starting in MATLAB R2023a when you change the Rotation property of axis labels in a 2-D plot, the HorizontalAlignment and VerticalAlignment properties of the label automatically change to prevent overlap between the label and the axes.
ylabel('Really long axis label','FontSize',15,'rotation',0)

カテゴリ

Help Center および File ExchangeAxes Appearance についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by