clabel
Contour labeling
📝Syntax
clabel(C,h)
clabel(C,h,v)
clabel(C)
clabel(C,v)
tl = clabel(...)
clabel(...,Name,Value)
📥Input Arguments
Parameter Description
C

Contour matrix returned by contour, contourf, or contour3. If you pass a contour object h, you may pass [] for C.

h

Contour object handle returned by contour / contourf / contour3. When provided, labeling uses information attached to the contour object (levels and contour matrix).

v

Vector of contour levels to label. When provided, only these levels receive labels.

📤Output Arguments
Parameter Description
t

Text objects created by clabel. The String properties contain the contour values displayed.

tl

Text and line objects created when upright markers are used (for clabel(C)-style usage).

📄Description

The clabel function inserts labels into contour plots:

💡Examples
Label contour plot levels (basic).
figure();
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
clabel(C,h)
      
Example illustration
Label specific contour levels.
figure();
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
v = [2,6];
clabel(C,h,v)
      
Example illustration
Set contour label properties with Name,Value pairs.
figure();
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
clabel(C,h,'FontSize',15,'Color','red')
      
Example illustration
Label using only the contour matrix (upright labels).
figure();
[x,y,z] = peaks;
C = contour(x,y,z);
clabel(C)
      
Example illustration
🔗See Also
contourcontourfcontourc
🕔Version History
Version Description
1.15.0 initial version
Edit this page on GitHub