sgtitle
Add a shared title to a graphics layout.
📝Syntax
sgtitle(text)
sgtitle(target, text)
sgtitle(..., propertyName, propertyValue)
go = sgtitle(...)
📥Input Arguments
Parameter Description
text Text to display.
target A tiled layout or axes graphics object.
propertyName Text object property name.
propertyValue Text object property value.
📤Output Arguments
Parameter Description
go A graphics object for the shared title.
📄Description

sgtitle adds a shared title to the current tiled layout when one exists. Otherwise, it adds a shared title above the subplot axes in the current figure.

💡Examples
Shared title for a subplot grid.
f = figure();
subplot(2, 2, 1)
title('First Subplot')
subplot(2, 2, 2)
title('Second Subplot')
subplot(2, 2, 3)
title('Third Subplot')
subplot(2, 2, 4)
title('Fourth Subplot')
sgtitle('Subplot Grid Title')
Example illustration
Set shared title properties.
f = figure();
subplot(2, 1, 1)
title('First Subplot')
subplot(2, 1, 2)
title('Second Subplot')
sgt = sgtitle('Subplot Grid Title', 'Color', 'red');
sgt.FontSize = 20;
Example illustration
Shared title for a tiled layout.
t = tiledlayout(2, 1);
nexttile(t);
plot(1:10);
nexttile(t);
plot((1:10).^2);
sgtitle(t, 'Shared title');
🔗See Also
titletiledlayout
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub