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

9 ビュー (過去 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 Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by