|On this page…|
In a MATLAB® figure, a title is a text string at the top of an axes. It appears in the figure border, not within the axes it describes. Titles typically define the subject of the graph. The following figure shows a title, centered at its top.
Note While you can use text annotations to create a title for your graph, it is not recommended. Titles are anchored to the top of the axes they describe; text annotations are not. If you move or resize your axes, the title remains at the top. Additionally, if you cut a title and then paste it back into a figure, the title is no longer anchored to the axes.
You can add a title to a graph interactively in several ways, described in the following sections.
To add a title to a graph using the Insert menu,
When you are finished entering text, click anywhere in the figure background to close the text entry box around the title. If you click on another object in the figure, such as an axes or line, you close the title text entry box and also automatically select the object you clicked.
To change the font used in the title to bold, you must edit the title. You can edit the title as you would any other text object in a graph.
To add a title to a graph using the Property Editor,
Double-click an empty region of the axes in the graph. This starts the Property Editor. You can also start the Property Editor by right-clicking on the axes and selecting Show Property Editor from the context menu or by selecting Property Editor from the View menu.
The Property Editor displays a property panel specific to axes objects. Titles are a property of axes objects.
You can change the font, font style, position, and many other aspects of the title format.
To move the title, select the text and drag it to the desired position.
To edit the text, double-click the title and type new characters.
To change the font and other text properties, select the title and right-click to display the context menu.