A single title on top of a subplot
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.
Example
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
引用格式
Shoaibur Rahman (2024). 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. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!