Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

clegendm

Add legend labels to map contour display

Syntax

clegendm(cs,h)
clegendm(cs,h,loc)
clegendm(...,unitstr)
clegendm(...,labels)
h = clegendm(...)

Description

clegendm(cs,h) adds a legend specifying the contour line heights to the current map contour plot.

clegendm(cs,h,loc) places the legend in the specified location.

clegendm(...,unitstr) appends unitstr to each entry in the legend.

clegendm(...,labels) uses the text specified in labels to label the legend. labels must have the same number of entries as the line children of h.

h = clegendm(...) returns the handle to the legend object created.

Input Arguments

cs

Contour matrix output from contourm, contour3m, or contourfm

h

Object handle output from contourm, contour3m, or contourfm

loc

Any of the following integers, with the indicated placement:

IntegerPlacement

0

Automatic placement (default)

1

Upper right corner

2

Upper left corner

3

Lower left corner

4

Lower right corner

-1

To the right of the plot

unitstr

Character vector appended to each entry in the legend

labels

Cell array of character vectors used to label the legend

Output Arguments

h

Handle to the legend object

Examples

Create a legend in the lower right-hand corner, specifying the contour elevations are in meters:

load topo
R = georasterref('RasterSize', size(topo), ...
   'Latlim', [-90 90], 'Lonlim', [0 360]);
figure('Color','w'); worldmap('world')
[c,h] = contourm(topo, R, -6000:1500:6000);
clegendm(c,h,4,' m')

Introduced before R2006a

Was this topic helpful?