How to change the angle of xticklabel?

5 次查看(过去 30 天)
Matlab has been automatically slanting my xTickLabels even when the font size is not that big and can fit the x-axis just fine without angled.
Is there a way to force it to be angled at 0-degrees (i.e., not slanted)?
Many thanks!

采纳的回答

Voss
Voss 2022-2-2
编辑:Voss 2022-2-2
You can use set(gca(),'XTickLabelRotation',0);
To demonstrate:
figure();
plot(1:10);
set(gca(),'XLim',[1 10],'XTick',1:0.5:10,'Fontsize',16); % automatically rotated
figure();
plot(1:10);
set(gca(),'XLim',[1 10],'XTick',1:0.5:10,'Fontsize',16,'XTickLabelRotation',0); % force to horizontal

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by