How to change the angle of xticklabel?
    9 views (last 30 days)
  
       Show older comments
    
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! 
0 Comments
Accepted Answer
  Voss
      
      
 on 2 Feb 2022
        
      Edited: Voss
      
      
 on 2 Feb 2022
  
      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 Comments
More Answers (0)
See Also
Categories
				Find more on Surface and Mesh Plots in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


