How can I change the degree symbol in axis tick label while using axesm function?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Md Atiqul Islam
el 1 de Nov. de 2019
Comentada: Md Atiqul Islam
el 5 de Nov. de 2019
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 comentarios
darova
el 4 de Nov. de 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
Respuesta aceptada
darova
el 4 de Nov. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Axis Labels en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!