change ticklabels using m_map
26 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I have problems to change ticklabels using m_map.
My labels for longitude and latitude are overlapping, so I tried to set specific labels for the longitude. The longitude range for my map is -180 to 180.
I have used the following command.
m_grid('xaxis','middle','xtick',5,'xticklabel',{'120W','60W','0','60E','120E'},'ytick',5);
The result with this command is always, that I got longitude labels from -180 to 180. I tried many other things which are recommended just for Matlab, but it is still not working.
Does someone know how to change the labels using m_map?
0 commentaires
Réponses (1)
Fernand ASSENE
le 11 Août 2020
Hi Lena Frey. I got the same issue as you, and i found that "help m_grid" shows wrong way to use "xtick" option, It's very annoying. Or it works depending on MATLAB version you use, i don't know.
help proposes to use "xtick" option as :
'xtick',[ num | [value1,value2, ...] % num = number of ticks
Above a wright way to use this option that i found :
'xtick',([value1 value2, ...])
This is an example
m_grid('linewi',2,'linest','none','tickdir','out',...
% set "xtick"/"ytick" values as you want, but must ranging from min to max of each coordinate
'xtick',([-40 -30 -20 -10 0 10]),... % longitude
'xticklabel',{'40°W','30°W','20°W','10°W','0','10°E'}); % name longitude ticks as you want
'ytick',([-6 -4 -2 0 2 4 6])); % latitude
'xticklabel',{'6°S','4°S','2°S','0','2°N','4°N','6°N'}); % name latitude ticks as you want
I hope it will be useful for someone.
0 commentaires
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!