Products & Services Solutions Academia Support User Community Company

Learn more about Mapping Toolbox   

contourfm - Project filled 2-D contour plot of map data

Syntax

contourfm(lat,lon,Z)
contourfm(Z,R)
contourfm(lat,lon,Z,n,...)
contourfm(...,v,...)
contourfm(...,LineSpec)
c = contourfm(...)
[c,h] = contourfm(...)

Description

contourfm(lat,lon,Z) produces a contour plot of map data projected onto the current map axes. The input latitude and longitude vectors can be the size of Z (as in a geolocated data grid), or can specify the corresponding row and column dimensions for the map.

contourfm(Z,R) creates a contour plot of the regular data grid, Z. R is either a 1-by-3 vector containing elements:

[cells/degree northern_latitude_limit western_longitude_limit]

or a 3-by-2 referencing matrix that transforms raster row and column indices to or from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel. For more information about referencing vectors and matrices, see the section Understanding Raster Geodata in the User's Guide.

contourfm(lat,lon,Z,n,...) draws n contour levels, where n is a scalar.

contourfm(...,v,...) draws contours at the levels specified by the input vector v.

contourfm(...,LineSpec) uses any valid LineSpec string to draw the contour lines.

c = contourfm(...) returns a standard contour matrix, with the first row representing longitude data and the second row representing latitude data.

[c,h] = contourfm(...) returns the contour matrix and an array of handles to the contour patches drawn.

Examples

Plot the Earth's geoid with filled contours. The data is in meters.

load geoid
figure
axesm eckert4
framem;gridm
load coast
plotm(lat,long,'k')
caxis([-120 100]);colormap(jet(11));colorbar
contourfm(geoid,geoidrefvec,-120:20:100);

You can reproduce the filled contour display by using a surface instead of the patches created by contourfm.

figure
axesm eckert4
framem;gridm
load coast
plotm(lat,long,'k')
meshm(geoid,geoidrefvec,size(geoid),'Facecolor','interp')
contourcmap(20,'jet');colorbar

Surfaces also allow use of lighting to bring out the smaller variations in the data.

clmo surface
meshm(geoid,geoidrefvec,size(geoid),geoid,'Facecolor','interp')
light;lighting phong; material(0.6*[ 1 1 1])
set(gca,'dataaspectratio',[ 1 1 200])
gridm reset
zdatam(handlem('line'),max(geoid(:)))

Limitations

contourfm might not fill properly with azimuthal projections.

Remarks

By default, filled contour patches are displayed with no edge lines. To add contour lines, supply a lineSpec or specify an EdgeColor to contourfm. An EdgeColor may also be set later.

In most circumstances, contour plots made with surfaces are preferable to the filled patches created by contourfm. Surfaces are rendered more quickly and take less time to project and reproject. The use of surfaces also allows surface lighting to create shaded 3-D maps.

See Also

contourm, contour3m, clabelm, meshm, surfm

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS