Integer values on contour plots displayed differently to decimalised values?

7 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Andrew Newell
Andrew Newell le 14 Avr 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))

Plus de réponses (1)

Pascal Galloway
Pascal Galloway le 15 Avr 2011
Thank you! This is exactly the answer I was after, very helpful!

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by