clabelm

Add contour labels to map contour display

Syntax

  • clabelm(C)
  • clabelm(C,h) example
  • clabelm(C,v)
  • clabelm(C,h,v)
  • clabelm(___,Name,Value)
  • clabelm(C,'manual')
  • clabelm(C,h,'manual')
  • text_handles = clabel(___)

Description

clabelm(C) labels all contours displayed in the current contour plot. Labels are upright and displayed with '+' symbols. clabelm randomly selects label positions.

example

clabelm(C,h) rotates the labels and inserts them in the contour lines. This syntax inserts only those labels that fit within the contour, depending on the size of the contour.

clabelm(C,v) labels only the contour levels specified by the vector, v.

clabelm(C,h,v) labels only the contour levels specified by vector v, rotates the labels, and inserts them in the contour lines.

clabelm(___,Name,Value) specifies the text object properties and the 'LabelSpacing' contourgroup property, using one or more Name,Value pair arguments, in addition to any of the input arguments in previous syntaxes.

clabelm(C,'manual') places contour labels at locations you select with a mouse. Click the mouse or press the space bar to label the contour closest to the center of the crosshair. Press the Return key while the cursor is within the figure window to terminate labeling.

clabelm(C,h,'manual') places contour labels at locations you select with a mouse. Press the Return key while the cursor is within the figure window to terminate labeling. The labels are rotated and inserted in the contour lines.

text_handles = clabel(___) additionally returns an array containing the handles of the text objects created, using any of the input arguments in the previous syntaxes. If you call clabel without the h argument, text_handles also contains the handles of line objects used to create the '+' symbols.

Input Arguments

expand all

C — Contour matrix2-by-n matrix

Contour matrix containing the data that defines the contour lines. C is returned by the contourm, contourfm, or contour3m functions.

h — Handle to the contourgroup object

Handle to the contourgroup object returned by thecontourm, contourfm, or contour3m functions.

v — Contour level valuesvector

Contour level values, specified as a row or column vector of individual values.

Example: [0,10,20]

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'LabelSpacing' — Spacing between labels144 (default) | scalar

Spacing between labels on each contour line, specified as the comma-separated pair consisting of 'LabelSpacing' and a scalar. Specify the label spacing in points, where 1 point = 1/72 inch.

Example: 'LabelSpacing',72

Output Arguments

expand all

text_handles — Handles of text objects

Handles of the text objects that clabelm creates. The UserData properties of the text objects contain the contour values displayed.

If you call clabelm without the h argument, text_handles also contains the handles of line objects used to create the '+' symbols.

Examples

expand all

Add Labels to a Contour Map

Generate a contour map and obtain the contour matrix, C, and the handle to the contourgroup object, h. Then display labels on the contour map.

load geoid
axesm miller
framem
tightmap
[C,h] = contourm(geoid,geoidlegend,-100:50:80);
clabelm(C,h)

Was this topic helpful?