File Exchange

image thumbnail

A single title on top of a subplot

version (1006 Bytes) by Shoaibur Rahman
Use this function to print a title on the top of a group of subplots


Updated 28 Jan 2016

View Version History

View License

When using subtitle('MY TITLE','PorpertyName','PropertyValue'...), or subtitle('MY TITLE') after a group of subplots, then it provides a title MY TITLE with any property used that is defined in the original title function in Matlab, but without affecting the titles, xlables and ylabels of any of the subplots.
Make sure to use the function after the group of subplots.
x = 0:0.01:6;
subplot(221), plot(x,sin(x)), xlabel('x'), ylabel('sin(x)'), title('sin(x)')
subplot(222), plot(x,cos(x)), xlabel('x'), ylabel('cos(x)'), title('cos(x)')
subplot(223), plot(x,sin(2*x)), xlabel('x'), ylabel('sin(2x)'), title('sin(2x)')
subplot(224), plot(x,cos(2*x)), xlabel('x'), ylabel('cos(2x)'), title('cos(2x)')
subtitle('Single title on top','FontSize',12,'Color','r')
See also:
title, suplabel, subplot

Cite As

Shoaibur Rahman (2021). A single title on top of a subplot (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (16)

Eugenio Candeias

Veronica Caputo

It works very well. But when I try to put in my title something like "_Title", the "T" goes in subscript. How can I fix it?

Danny Farell

you can put a vertical offset to the supertitle with supertitle('your title \newline ') so the supertitle wont overlap with any of the subplots title. Dont forget the space between \newline and Apostrophe.

Monika Tarasiuk

sampath S

how to insert this new file


Superb. It is working fine.

Kia Miller


I agree with Matt's issue with the vertical position. Without handling the offset, this function does not help me in the slightest.

Raghavi B

There was an error in line 6 in the example given. Replace the 'subtitle' command as 'supertitle'.
It works great. Thanks.

Yoav Rosenberg

Yoav Rosenberg


The function does not address the vertical position of the "supertitle," which causes interferences with normal titles in some configurations. To use the example in the file description (2x2), the "supertitle" is placed at the same vertical position as the titles of the plots in the top row. If the "supertitle" is longer than the space between the two normal titles, they will overlap.


Problem solved. Thanks!


Works good with subplots. But if I use this function, I cannot use the linkaxes functionality as the axes is set to 'off'. Any workarounds?


Simple and easy to use, but works like a magic what exactly I wanted!

Adam Danz

Similar to "suptitle" in the bioinfo toolbox except does not re-adjust subtitle axes.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!