Filling Plot Area, Adding Ticks in Mapping with Projections
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm using pcolorm (of the Mapping Toolbox) with the miller projection to create a global map:
figure(2)
axesm miller
pcolorm(LatVec,LonVec,my2DMap)
shading flat
grid off
ylabel('Latitude (Degrees North)')
xlabel('Longitude (Degrees East)')
tightmap
title('My Map')
set(gca,'YTick',1:180)
Where LatVec is a 1xn vector ranging from -90 to 90 degrees, and LonVec is a 1xn vector ranging from -180 to 180 degrees. my2DMap is a 2D matrix containing the data to be plotted (corresponding to the color scale) at each latitude and longitude coordinate. The result can be accessed here: http://www-personal.umich.edu/~ddchen/files/map.jpg.
I'm having 2 issues and would appreciate any help: 1. How do I make the data fit inside the plot area (without white spaces on top and bottom of the map)? I tried used xlim and ylim but they made the map too small to see. 2. How do I add tickmarks correctly on both axes? I tried to set the YTick property but it added 2 ticks on the y axis (1, 2), which are obviously incorrect.
Thanks, David
0 个评论
采纳的回答
Justin
2012-5-11
Even better solution:
If you get the axis handle you can use: setm(ax,'mlabellocation',.2,'plabellocation',.2,'mlinelocation',.2,'plinelocation',.2)
0 个评论
更多回答(1 个)
Justin
2012-5-11
I've played around and finally found something that's a tolerable solution...It does mean having grid lines, though. You can use gridm and the option 'mlinelocation'
e.g., gridm('glinestyle','-','mlinelocation',-104.8:.05:-104.6) or gridm('glinestyle','-','plinelocation',.05)
I hope this helps!
Justin
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!