Graphics |
When you use the text
command to display a character string, the string's position is defined by a rectangle called the Extent
of the text. You can display this rectangle either as a box or a filled area. For example, you can highlight contour labels to make the text easier to read.
[x,y] = meshgrid(-1:.01:1); z = x.*exp(-x.^2-y.^2);; [c,h]=contour(x,y,z); h = clabel(c,h); set(h,'BackgroundColor',[1 1 .6])
For additional features, see the following text properties:
BackgroundColor
- color of the rectangle's interior (none by default).
EdgeColor
- color of the rectangle's edge (none by default).
LineStyle
- style of the rectangle's edge line (first set EdgeColor
).
LineWidth
- width of the rectangle's edge line (first set EdgeColor
)
Margin
- increase the size of the rectangle by adding a margin to the text extent.
Example - Multiline Text | Adding Arrows and Lines to Graphs |