MATLAB Answers

Insert degree symbol in axis title.

26 views (last 30 days)
Please see the attached image. How can i add such degree symbol in a matlab figure?
Kamruzzaman Bhuiyan
Kamruzzaman Bhuiyan on 1 Sep 2021
i have no idea about this tool. Is there any alternative method? Please help me. It’s urgent

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 1 Sep 2021
The degree symbol is ASCII character 176. So, here is a simple way:
% Plot some random data
% Set the tick positions, and label them with degrees
set(gca,'XTick',[0 0.5 1],'XTickLabel',{['98',char(176),'E'],['99',char(176),'E'],['100',char(176),'E']})
There are more sophisticated ways to build a longer vector (but using the same basic idea), e.g. using sprintf.

More Answers (2)

Benjamin on 1 Sep 2021
xt = get(gca,'XTick');
xtl = arrayfun(@(x)sprintf('%d\\circE',x),xt,'UniformOutput',false);

Fangjun Jiang
Fangjun Jiang on 1 Sep 2021
Edited: the cyclist on 1 Sep 2021
doc title
search for "superscript"

Community Treasure Hunt

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

Start Hunting!