MATLAB: How to add two subtitle of two pictures

subplot

How can I add two different subtitle of these two pictures ?

Best Answer

Demos that add titles and/or subtitles to a plot:
How to add a title to each subplot
% Method 1: add titles as you create each subplot
figure
subplot(1,2,1)
title('Subplot one')
subplot(1,2,2)
title('Subplot two')
% Method 2: add titles after creating subplots
figure
h(1) = subplot(1,2,1);
h(2) = subplot(1,2,2);
title(h(1), 'Subplot one')
title(h(2), 'Subplot two')
How to add a subtitle to each of the subplot titles
Starting in r2020b, you can add a title and subtitle using
[t,s]=title('myTitle','mySubtitle')
or
t = title('myTitle');
s = subtitle('mySubtitle');
For Matlab release prior to r2020b, use one of these methods to add a subtitle.
figure
h = subplot(1,2,1);
formattedText = {'\fontsize{12}\color{black}\bfTitle1'; '\fontsize{8}\color{gray}\rmTitle2'};
% _______ _______
% title subtitle
h = title(h, formattedText);
...or more simply
h = subplot(1,2,2);
title(sprintf('Title1\nSubtitle1'))