Insert Degree Symbol in Axes Title

2.853 Ansichten (letzte 30 Tage)
Med_Imager
Med_Imager am 15 Mär. 2012
Bearbeitet: Zayin Jarrez am 4 Mär. 2024
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!

Akzeptierte Antwort

Thomas
Thomas am 15 Mär. 2012
Bearbeitet: MathWorks Support Team am 22 Mai 2019
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:

Weitere Antworten (3)

Engenuity
Engenuity am 6 Nov. 2016
ALT + 248 does the trick using Windows OS
  7 Kommentare
Kenneth George
Kenneth George am 8 Jul. 2022
Not sure if this will help someone in the future, but I ran across this and realized that typing the numbers using the number row on my keyboard does not work, but typing the numbers using the numpad does work. Can't tell if this is keyboard dependent, but occurs with both my laptop and desktop. Disappointing for users that don't have a numpad.
Zayin Jarrez
Zayin Jarrez am 4 Mär. 2024
Bearbeitet: Zayin Jarrez am 4 Mär. 2024
Nice trick

Melden Sie sich an, um zu kommentieren.


carlo lefevre
carlo lefevre am 3 Feb. 2016
°C

Honglei Chen
Honglei Chen am 15 Mär. 2012
By default, title('20^{\circ}') should work. If not, you can do
title('20^{\circ}','Interpreter','tex')
  1 Kommentar
Brian
Brian am 21 Sep. 2015
\circ is apparently not the same as a degree symbol. Journals sometimes object to the \circ characterization of the degree symbol.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by