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

23 views (last 30 days)
George Koh on 15 Jan 2017
Commented: frank2243 on 12 Dec 2017
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')
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')
plotm(coastlat,coastlon);
You can run both of them and see the difference. I'll attach the two figures.

George Koh on 15 Jan 2017
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.
frank2243 on 12 Dec 2017
Hi George,
Could you please tell me how you did it? I have the exact same problem as you when using Origin.
Thank you.