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')
title, suplabel, subplot
Shoaibur Rahman (2020). A single title on top of a subplot (https://www.mathworks.com/matlabcentral/fileexchange/48742-a-single-title-on-top-of-a-subplot), MATLAB Central File Exchange. Retrieved .
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?
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.
how to insert this new file
Superb. It is working fine.
I agree with Matt's issue with the vertical position. Without handling the offset, this function does not help me in the slightest.
There was an error in line 6 in the example given. Replace the 'subtitle' command as 'supertitle'.
It works great. Thanks.
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!
Similar to "suptitle" in the bioinfo toolbox except does not re-adjust subtitle axes.
Name changes to supertitle