How can I change the degree symbol in axis tick label while using axesm function?

12 views (last 30 days)
Hello everyone,
You can see that the degree symbol in axis tick label (see Figure 1) is a bit higher position than normal. I tried to change it perfectly superscript (see Figure 2) taking handle of the function axesm but I can't. I did not find any option in the handle to change it. I used text function instead to prepare Figure 2. It is very time consuming to make degree symbol perfectly superscript using textm function. Some journal ask to make degree symbol perfectly superscript.
  4 Comments
darova
darova on 4 Nov 2019
This code
plot(0,0)
title('90{\circ}')
% title(['90' char(176)])
text(1.5,0.02,'20{\circ} N','FontName','Times New Roman','FontSize',12);
text(1.5,0.16,'21{\circ} N','FontName','Times New Roman','FontSize',12);
xlim([-1 3])
Produces this
img1.png
Md Atiqul Islam
Md Atiqul Islam on 4 Nov 2019
@darova: could you please change the degree symbol in the tick labels of the following figure?
latlim = [-80 80];
lonlim = [100 -120];
figure
axesm('robinson','MapLatLimit',latlim,'MapLonLimit',lonlim,...
'Frame','on','Grid','on','MeridianLabel','on','ParallelLabel','on')
axis off
setm(gca,'MLabelLocation',60)
load coastlines
plotm(coastlat,coastlon)

Sign in to comment.

Accepted Answer

darova
darova on 4 Nov 2019
If you type something like:
h = get(gca,'children');
>> get(h(2),'string')
You will see that each label has "^" symbol
ans =
60^{\circ} N
So i just deleted that symbol:
h = get(gca,'children');
for i = 1:length(h)
if strcmp(get(h(i),'type'), 'text') % check if object is text
str = get(h(i),'string'); % get string
ix = strfind(str,'^'); % find "^" symbol
str(ix) = []; % delete the symbol
set(h(i),'string',str)
end
end
I have older MATLAB (v2013), maybe code will be a bit different with yours

More Answers (0)

Community Treasure Hunt

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

Start Hunting!