Filling Plot Area, Adding Ticks in Mapping with Projections

5 vues (au cours des 30 derniers jours)
David C
David C le 27 Fév 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

Réponse acceptée

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

Plus de réponses (1)

Justin
Justin le 11 Mai 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

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by