MATLAB: Integer values on contour plots displayed differently to decimalised values

contour

Hi All,
Strange one really but I have noticed that integer values on contour plots ('ShowText') are displayed differently to those with a decimal part e.g. 3 will be postioned and displayed slightly differently to 3.1
I believe this could be solved if I could get Matlab to replace 3 with 3.0 but I do not know how to do this?
The reason it is annoying is the integer values are displayed with less white space around them making them less legible.
If anyone has any advice this would be useful, thanks!
Pascal.

Best Answer

Suppose you have labeled the contours using commands like these:
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
text_handles = clabel(C,h,'LabelSpacing',72);
You now have an array of handles, one for each label. You can increase the space around them using
set(text_handles,'Margin',6) % put whatever number you like here
However, this margin won't show unless you also assign a color to the text box using a command like
set(text_handles,'BackgroundColor','w')
You can see what other properties can be set using
set(text_handles(1))
and their current values using
get(text_handles(1))