clabel
Adds value labels to the lines of a contour plot.
Category: Graphics > 2-D and 3-D Plots
Syntax
clabel(C, h)
Labels the contour lines in h using the matrix C.
clabel(C, h, v)
Labels only the levels listed in v.
clabel(C, h, 'manual')
Selects label positions with the mouse.
Description
Each label is the numeric value of its level, placed on the line. Get both C and h from the contour call: [C, h] = contour(Z). Alternatively, set the ShowText property of the contour object to 'on'.
Input arguments
C- Contour matrix returned by
contour,contourforcontourc. h- Contour object returned as the second output of
contour. v- Vector of levels to label.
Example
Label the levels
[X, Y] = meshgrid(-2:0.25:2);
Z = X.^2 + Y.^2;
[C, h] = contour(X, Y, Z, [1 2 3]);
clabel(C, h)
In the app, the figure is drawn below the code.