MATLAB Answers

Label Rotation in MATLAB 2014

86 views (last 30 days)
Matlab2010
Matlab2010 on 15 Sep 2014
Answered: Mina Kheirkhah on 29 Jan 2019
Has MATLAB 2014a introduced a built in way of rotating axis labels? see here.
plot(1:3);
set(gca, 'XTICK', 1:3);
set(gca, 'XTICKLABEL', {'aaa', 'bbb', 'ccc'});
set(gca, 'Rotation', 45);
However this gives:
Error using hg.axes/set
The name 'Rotation' is not an accessible property for an instance of class 'axes'.
Have I misunderstood?

  2 Comments

Carl Witthoft
Carl Witthoft on 20 May 2015
This works: set(get(gca,'YLabel'),'Rotation',-25);
Javier
Javier on 15 Feb 2017
Just works for labels, not for Ticks.

Sign in to comment.

Answers (2)

Sean de Wolski
Sean de Wolski on 15 Sep 2014
In R2014a, you need to replace the tick labels with text which can be rotated. here are a few utilities to help:

  3 Comments

Matlab2010
Matlab2010 on 15 Sep 2014
This is new functionality in 2014B that isn't present in 2014a? Correct?
Sean de Wolski
Sean de Wolski on 15 Sep 2014
The above is R2014a.
R2014b has not shipped and the R2014b prerelease's features are confidential under NDA.
Steven Lord
Steven Lord on 15 Feb 2017
Now that release R2014b has shipped, I can confirm that tick label rotation was added in that release. See the "Other enhancements and new customization options" paragraph in the "New Visual Look" section of this documentation page.

Sign in to comment.


Mina Kheirkhah
Mina Kheirkhah on 29 Jan 2019
Just use: xtickangle(45)

  0 Comments

Sign in to comment.

Tags


Translated by