Mapping Toolbox: How to show MLabel and PLabel when using axesm with Origin, FLatLimit and FLonLimit?

9 次查看(过去 30 天)
The question tells it all... I've had this problem http://www.mathworks.com/matlabcentral/answers/319515-how-to-fit-axes-to-contourm-plot, which I've solved by changing the point of Origin of the axesm command(it centered the axes on the contourm plot). FLatLimit and FLonLimit did the trick i needed(fix the axes). But that's when it turned back at me. In my first attempt I had the Meridian and Parallel labels showing but not after using Flatlimit and FLonlimit.
I'm almost sure that these two properties are the culprit because I changed it back to MapLat and Lon and labels were showing(then the axes are wrong).
What do I do to have labels? I need my labels...
I'm posting below the two cases I'm talking about...
FIRST CASE Using MapLatLimit and MapLonLimit
min_lat = 31.5062;
max_lat = 50.2412;
min_lon = 10.4604;
max_lon = 42.0652;
figure(); title('Using map limit')
axesm('MapProjection','lambert',...
'MapLatLimit',[min_lat max_lat],...
'MapLonLimit',[min_lon max_lon],...
'MeridianLabel','on',...
'ParallelLabel','on',...
'Grid','on',...
'Frame','on')
load coastlines
plotm(coastlat,coastlon);
SECOND CASE Using Origin, FLatLimit and FLonLimit
min_lat = 31.5062;
max_lat = 50.2412;
min_lon = 10.4604;
max_lon = 42.0652;
[dist,az] = distance(min_lat,min_lon,max_lat,max_lon);
[originLat,originLon] = reckon(min_lat,min_lon,dist/2,az);
midAz = azimuth(originLat,originLon,max_lat,max_lon);
lat_limit = [-8 7.8];
lon_limit = [5.2 -3.6];
figure(); title('Using F limit')
axesm('MapProjection','lambert',...
'Origin',[originLat originLon az-midAz+0.3],...
'FLatLimit',lat_limit,...
'FLonLimit',[-dist/2 dist/2] + lon_limit,...
'MeridianLabel','on',...
'ParallelLabel','on',...
'Grid','on',...
'Frame','on')
load coastlines
plotm(coastlat,coastlon);
You can run both of them and see the difference. I'll attach the two figures.

采纳的回答

George Koh
George Koh 2017-1-15
Solved it. When using Origin, FLatLimit and FLonLimit the labels location are set by default at -180(Parallel) and 0(Meridian). I had to use gcm for the current figure to see "where" the labels where. Then by using setm(gca,'MLabelParallel') and setm(gca,'PLabelMeridian'), and with little experimentation, I found the two labels.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by