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.
h = axes('Color',[.9 .9 .9],... 'GridLineStyle','--',... 'ZTickLabels','-1|Z = 0 Plane|+1',... 'FontName','times',... 'FontAngle','italic',... 'FontSiz
e',14,... 'XColor',[0 0 .7],... 'YColor',[0 0 .7],... 'ZColor',[0 0 .7]);
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
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
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
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|