MATLAB Answers

1

Insert Degree Symbol in Axes Title

Asked by Med_Imager on 15 Mar 2012
Latest activity Edited by MathWorks Support Team on 22 May 2019 at 15:45
Hello
Anyone know how to display the degree symbol ° in the title on a plot? Also want to know how to display it on the top of the figure.
set (Handle3, 'NumberTitle', 'Off', 'Name', 'Slice profile for a 20^{\circ} sinc pulse ');
axis auto;title('Slice profile for a 20^{\circ} sinc pulse ');
Thanks!

  0 Comments

Sign in to comment.

Tags

4 Answers

Answer by Thomas
on 15 Mar 2012
Edited by MathWorks Support Team on 22 May 2019 at 15:45
 Accepted Answer

You can create any character by finding its Unicode value and converting that number into a character, using the “char” function. Then you can add that character to any character vector or string.
For example, the number 176 is the Unicode value that denotes the degree symbol. You can convert 176 to a character and add it to your text.
axes
title(['Slice profile for a 20' char(176) ' sinc pulse'])
Setting the figure title is similar, but you have to set the 'Name' property. You might want to turn the 'NumberTitle' off too.
figure('Name', ['Slice profile for a 20' char(176) ' sinc pulse'], 'NumberTitle', 'off')
The list of all Unicode characters is very large. For more information, including the numeric values of Unicode characters, see:

  1 Comment

Ha! worked! Thanks!

Sign in to comment.


Answer by Engenuity
on 6 Nov 2016

ALT + 248 does the trick using Windows OS

  1 Comment

Sign in to comment.


Answer by carlo lefevre on 3 Feb 2016

°C

  0 Comments

Sign in to comment.


Answer by Honglei Chen
on 15 Mar 2012

By default, title('20^{\circ}') should work. If not, you can do
title('20^{\circ}','Interpreter','tex')

  1 Comment

\circ is apparently not the same as a degree symbol. Journals sometimes object to the \circ characterization of the degree symbol.

Sign in to comment.