MATLAB: How to set text properties using clabelm

clabelmfontMATLABproperties

How to set the text and background color properties when using the 'clabelm' function which can be done in the 'clabel' function by mentioning the property names directly as parameters?

Best Answer

You can control the fontsize, color and background using the 'clabelm' function. The 'clabelm' function works slightly differently than the 'clabel' function with respect to setting these properties.
A small example to understand how to use these properties in regards to 'clabelm', is given below:
>> [C,h] = contourfm(x,y,z); % Create the filled contour and return the contour matrix in 'C' and handle to the contour patches in 'h'
>> htext = clabelm(C,h); % Pass the handle as a parameter to 'clabelm'. This returns an array containing the handles of the text objects created.
>> set(htext,'FontSize',10); % Use various properties to control the various aspects of the text, background etc.