MATLAB Answers

Filling Plot Area, Adding Ticks in Mapping with Projections

20 views (last 30 days)
David C
David C on 27 Feb 2012
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 Comments

Sign in to comment.

Accepted Answer

Justin
Justin on 11 May 2012
Even better solution:
If you get the axis handle you can use: setm(ax,'mlabellocation',.2,'plabellocation',.2,'mlinelocation',.2,'plinelocation',.2)

  0 Comments

Sign in to comment.

More Answers (1)

Justin
Justin on 11 May 2012
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 Comments

Sign in to comment.


Translated by