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

12 次查看(过去 30 天)
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 个评论
darova
darova 2019-11-4
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 2019-11-4
@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)

请先登录,再进行评论。

采纳的回答

darova
darova 2019-11-4
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by