MATLAB: Map axis description (degrees).

mapmercator

Welcome. At the beginning, I apologize for my English.
Below is a fragment of the matlab code:
landareas=shaperead('landareas.shp','UseGeoCoords',true);
axesm ('mercator','Frame','on','Grid','on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
showaxes;
xtixr = get(gca, 'XTick');
xtixlbl = regexp(sprintf('%.1f°\n',xtixr*180/pi), '\n', 'split');
set(gca, 'XTick', xtixr, 'XTickLabel',xtixlbl)
ytixr = get(gca, 'YTick');
ytixlbl = regexp(sprintf('%.1f°\n',ytixr*90/pi), '\n', 'split');
set(gca, 'YTick', xtixr, 'YTickLabel',ytixlbl)
hold on
As a result I get this:
But I need something like that:
How to improve my code to get meridians and parallels at regular intervals? (picture number 2).
The second question is how to put the description of the axis so that it covers only the drawing window? (as in the second image) In the range from 0 to 180 degrees (horizontal) and from 0 to 90 degrees (vertically)?

Best Answer

It is easier than you think, try this
landareas=shaperead('landareas.shp','UseGeoCoords',true);
axesm ('mercator','Frame','on','Grid','on',...;
'FLatLimit',[-90 90],...
'FLonLimit',[-180 180])
gridm('on');axis off;mlabel on;plabel on
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
set(gca,'position',[0 0 1 1])