Graphics    

Labeling and Appearance Properties

MATLAB provides a number of properties for labeling and controlling the appearance of axes. For example, this surface plot shows some of the labeling possibilities and indicates the controlling property.

Creating Axes with Specific Characteristics

To create this axes, specify values for the indicated properties.

Axis Labels

The individual axis labels are text objects whose handles are normally hidden from the command line (their HandleVisibility property is set to callback). You can use the xlabel, ylabel, zlabel, and title functions to create axis labels. However, these functions affect only the current axes. If you are labeling axes other than the current axes by referencing the axes handle, then you must obtain the text object handle from the corresponding axes property. For example,

returns the handle of the text object used as the x-axis label. Obtaining the text handle from the axes is useful in M-files and MATLAB-based applications where you cannot be sure the intended target is the current axes.

The following statements define the x- and y-axis labels and title for the axes above.

Since the labels are text, you must specify a value for the String property, which is initially set to the empty string (i.e., there are no labels).

MATLAB overrides many of the other text properties to control positioning and orientation of these labels. However, you can set the Color, FontAngle, FontName, FontSize, FontWeight, and String properties.

Note that both axes objects and text objects have font specification properties. The call to the axes function on the previous page set values for the FontName, FontAngle, and FontSize properties. If you want to use the same font for the labels and title, specify these same property values when defining their String property. For example, the x-axis label statement would be


  Axes Objects Positioning Axes