How to hide the grid lines behind a marker in map axes using GRIDM function in Mapping Toolbox 3.2 (R2010b)?

2 views (last 30 days)
When I use GRIDM for a map containing a marker, the grid lines appear in front of the marker.
axesm('pcarree','MapLatLimit',[-90 90],'MapLonLimit',[-90 90]);
gridm
plotm(0,0,'o','markersize',18,'markerfacecolor','g');
I want to hide the grid lines behind the marker.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Feb 2011
The grid lines appear in front of the marker as the default ‘ZData’ property of grid lines is positive. Set the ‘ZData’ values of grid lines to be negative.
axesm('pcarree','MapLatLimit',[-90 90],'MapLonLimit',[-90 90]);
Hg = gridm;
plotm(0,0,'o','markersize',18,'markerfacecolor','g');
% Get the size of 'Zdata'
Z1n=size(get(Hg(1),'ZData'));
Z2n=size(get(Hg(2),'ZData'));
% set the ‘ZData’ values to -1
set(Hg(1),'ZData',-ones(Z1n));
set(Hg(2),'ZData',-ones(Z2n));

More Answers (0)

Products


Release

R2010b

Community Treasure Hunt

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

Start Hunting!