subtitle

Adds a second, smaller line of text under the title of the axes.

Category: Graphics > Formatting and Annotation

Syntax

subtitle(txt)

Sets the subtitle of the current axes.

subtitle(txt, Name, Value)

Sets text properties of the subtitle.

t = subtitle(___)

Returns the text object.

Description

The subtitle appears below the title in a smaller, gray font and is used for secondary information, such as the data source or the units. It is stored in the Subtitle property of the axes.

Input arguments

txt
Subtitle as text, a string array or a cell array of lines.

Output arguments

t
Text object of the subtitle.

Example

Title and subtitle

plot(1:5, [2 4 3 6 5])
title('Weekly sales')
t = subtitle('thousands of units');
t.String
Output
ans = 'thousands of units'

See also

title xlabel ylabel sgtitle text