How can I give degree symbol in XTicklabel in a bar graph?

7 views (last 30 days)
I used the following code in Matlab 2013b to give degree symbol in X-axis tick label.
set(gca,'XTicklabel',{'Neat PP';'0^{\circ}';'30^{\circ}';'45^{\circ}';'60^{\circ}';'90^{\circ}'})
It did not help me (please see attached figure). Can anyone please give me solution? Thank you.

Accepted Answer

Stalin Samuel
Stalin Samuel on 28 Oct 2015
set(gca,'XTicklabel',{'Neat PP'; [sprintf('0%c', char(176))];[sprintf('30%c', char(176))];[sprintf('45%c', char(176))];[sprintf('60%c', char(176))];[sprintf('90%c', char(176))]})

More Answers (1)

Stephen23
Stephen23 on 28 Oct 2015
Edited: Stephen23 on 28 Oct 2015
Make sure that the axes' TickLabelInterpreter property is set to either tex or latex:
The documentation includes a list of the TEX symbols and commands that can be used in MATLAB: click on the arrow in the subheading to show the full list.
  1 Comment
Steven Lord
Steven Lord on 28 Oct 2015
The TickLabelInterpreter property was introduced as part of the new graphics system in release R2014b. It is not available in release R2013b.

Sign in to comment.

Categories

Find more on Labels and Annotations 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!