Main Content

contour3m

Project 3-D contour plot of map data

Description

The contour3m function is the same as the contourm function except that the lines for each contour level are drawn in their own horizontal plane, at the z-coordinate equal to the value of that level.

Examples

collapse all

Get geoid heights and a geographic postings reference object from the EGM96 geoid model. Then, create a 3-D contour plot with 40 contour levels using a Miller projection. Eliminate extra white space using tightmap.

[N,R] = egm96geoid;
axesm miller
contour3m(N,R,40,'LineColor','k')
tightmap

Add the geoid as a surface, exaggerate the aspect ratio of the axes using daspect, and view the map in 3-D.

hold on
geoshow(N,R,'DisplayType','surface')
daspect([1 1 50])
view(3)

This example shows how to contour in a map axes the topography and bathymetry of South Asia and the northern Indian Ocean with a contour interval of 500 meters.

Load elevation raster data and a geographic cells reference object. Crop the data to an area around South Asia.

load topo60c
latlim = [0 50];
lonlim = [35 115];
[Z,R] = geocrop(topo60c,topo60cR,latlim,lonlim);

Display the data as a contour plot using a standard Lambert conformal conic projection.

figure
axesm('lambertstd','MapLatLimit',latlim,'MapLonLimit',lonlim)
tightmap
axis off
contour3m(Z,R,'k','LevelStep',500)

Display the topography as a surface. Apply a colormap appropriate for elevation data using the demcmap function. Then, add a title.

geoshow(Z,R,'DisplayType','surface')
demcmap(Z)
title({'South Asia Topography and Bathymetry', ...
   'with 500 m Contours'});

View the display in 3-D.

set(gca,'DataAspectRatio',[1 1 40000])
view(3)

Tips

  • If you use contour3m with the globe map display, the contour3m function warns. Be careful to scale the input data relative to the radius of your reference sphere.

Introduced before R2006a