MATLAB: How to change the spacing of grid lines on the map in the Mapping Toolbox

Mapping Toolbox

I am using the PLOTM command followed by the GRIDM command to produce a grid on my map. However, I would like to alter the spacing of the grid lines such that I get latitude and longitude lines at 2 degree intervals.

Best Answer

To adjust the spacing between the latitude and longitude lines of your grid, set the MLineLocation (Meridians) and PLineLocation (Parallels) properties of your grid appropriately. You may use the following code:
gridm('on');
gridm('mlinelocation',2,'plinelocation',2)
to set a spacing of 2 degrees each between the meridians and parallels respectively.