Graphics    

Adding Axes Labels to a Graph

In MATLAB, an axes label is a text string aligned with the x-, y-, or z-axis in a graph. Axes labels can help explain the meaning of the units that each axis represents.

To add axes labels to a graph, you can use any of these mechanisms:

Using the Label Options on the Insert Menu

  1. Click on the Insert menu and choose the label option that corresponds to the axes you want to label: X Label, Y Label, or Z Label. MATLAB opens a text entry box along the axes, or around an existing axes label.

  1. Enter the text of the label, or edit the text of an existing label.
  2. Click anywhere else in the figure background to close the text entry box around the label. If you click on another object in the figure, such as an axes or line, you close the label text entry box but also automatically select the object you clicked on.

Using the Property Editor to Add Axes labels

To add labels to a graph using the Property Editor:

  1. Start plot editing mode.
  2. Start the Property Editor by either double-clicking on the axes in the graph or by right-clicking on the axes and selecting Properties from the context-sensitive pop-up menu.

    The Property Editor displays the set of property panels specific to axes objects.

  1. Select the Labels panel. Enter the text of the label in the appropriate text entry box.

  2. Click Apply.

Using the Label Commands

You can add x-, y-, and z-axis labels using the xlabel, ylabel, and zlabel commands. For example, these statements label the axes and add a title.

The labeling commands automatically position the text string appropriately. MATLAB interprets the characters immediately following the backslash "\" as TeX commands. These commands draw symbols such as Greek letters and arrows. See the text String property for a list of TeX character sequences.


 Editing a Legend Adding Text Annotations to a Graph