Integer values on contour plots displayed differently to decimalised values?

4 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Andrew Newell
Andrew Newell il 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))

Più risposte (1)

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

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by