Products & Services Solutions Academia Support User Community Company

Learn more about Mapping Toolbox   

contourm - Project 2-D contour plot of map data

Syntax

contourm(Z, R)
contourm(lat, lon, Z)
contourm(Z, R, n)
contourm(Z, R, V) or contourm(lat, lon, Z, V)
contourm(..., linespec)
contourm(..., prop1, val1, prop2, val2,...)
C = contourm(...)
[C,h] = contourm(...)

Description

contourm(Z, R) creates a contour plot of the regular M-by-N 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.

If the current axis is a map axis, the coordinates of Z will be projected using the projection structure from the axis. The contours are drawn at their corresponding Z level.

contourm(lat, lon, Z) displays a contour plot of the geolocated M-by-N data grid, Z. lat and lon can be the size of Z or can specify the corresponding row and column dimensions for Z.

contourm(Z, R, n) or contourm(lat,lon,Z,n) where n is a scalar, draws n contour levels.

contourm(Z, R, V) or contourm(lat, lon, Z, V) where V is a vector, draws contours at the levels specified by the input vector v. Use V = [v v] to compute a single contour at level v.

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

contourm(..., prop1, val1, prop2, val2,...) specifies property/value pairs that modify contourgroup graphics properties. Property names can be abbreviated and are case-insensitive.

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

[C,h] = contourm(...) returns the contour matrix and the handle to the contour patches drawn onto the current axes. The handle is type hggroup.

Examples

Example 1

Contour EGM96 geoid heights as dotted lines and with 10 levels and set the contour labels on.

load geoid
figure
contourm(geoid, geoidrefvec, 10, ':','ShowText','on');
xlabel('Longitude');
ylabel('Latitude');

Example 2

Contour the Korean bathymetry and elevation data:

% Load the data.
load korea;                                                                
load geoid;                                                                

% Create a worldmap of Korea. 
figure
worldmap(map, refvec);                                             

% Display the digital elevation data and colormap.
geoshow(map, refvec, 'DisplayType', 'surface');
colormap(demcmap(map));
% Contour the geoid values from -100 to 100 in increments of 5.
[c,h] = contourm(geoid, geoidlegend, -100:5:100, 'k');                         

% Add red labels to the contours.
ht=clabel(c,h);
set(ht,'Color','r');

Example 3

Contour the geoid and topography heights:

% Load the data.
load topo
load geoid

% Create a Miller projection with geoid contours as red lines,
% and topography contours as black lines.
figure; axesm miller
hold on
contourm(geoid, geoidrefvec, 'r');
contourm(topo,  topolegend, 'k'); 

% Add the topograpy surface and color map.
geoshow(topo, topolegend, 'DisplayType', 'surface')
colormap(demcmap(topo))

% Set the surface as the lowest value of topo
% to keep the contour lines visible.
zdatam(handlem('surface'), min(topo(:)))

% Add a title
title('Contour Plot of Topography and Geoid Heights');

See Also

clabelm, clegendm, contour, contourc, contour3, contour3m, geoshow, plot

  


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