Integer values on contour plots displayed differently to decimalised values?
8 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Andrew Newell
on 14 Apr 2011
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))
0 Comments
More Answers (1)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!