How do I hide contour lines that overlap my map objects?

How do I hide contour lines that overlap my map objects?
When I display my data as contour plots on a map, some contour lines overlap with the map objects such as land and islands. How do I make them hide under the map objects? The following code shows this overlap:
load topo
axesm robinson; framem
[c,h]=contorm(topo,topolegend);
displaym(worldlo('POpatch'))

 Accepted Answer

The reason the contour lines are not getting hidden is that the patches and the contour lines are on the same Z level (the value is 0 by default). In order to have the contours hidden under the patches, the contours must be at a lower Z level than the patches. You can use the ZDATAM function to accomplish this. The following code is an example of how this works:
%
load topo;
axesm robinson; framem;
[c,h]=contorm(topo,topolegend);
displaym(worldlo('POpatch'));
title('Contours Overlap');
figure;
axesm robinson; framem
[c,h]=contorm(topo,topolegend);
displaym(worldlo('POpatch'));
zdatam(handlem('allline'),-1)
title('Contours hidden behind map objects');

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!