change ticklabels using m_map
조회 수: 26 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Fernand ASSENE
2020년 8월 11일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!