This post describes how to mark subplots as ,
,
and
and give a common title for all subplots.
Consider the case where we want to mark subplot(2,2,1) as . The circle around the letter is produced using latex command textcircled{a}. MatLab understands it as a latex command due to the ‘interpreter’ -> ‘latex’. It is placed at the desired location using MatLab’s text() command. Finally in MatLab this is produced by
‘, ‘Interpreter’, ‘latex’);
By default MatLab creates title for each individual plot using title(' ') command. This can be override by using the code from Line-23 to Line-27. Here is the brief description…
set(gcf,'NextPlot','add');
draw the next object to the current figure without clearing any graphics objects already present.
axes;
by itself, creates the default full-window axis and returns a handle to it.
set(gca,'Visible','off');
turn off the visibility of current axis
h = title('Common title for all subplots','fontweight','b');
Print the title to current axis and create the handle for this title, but not visible.
set(h,'Visible','on');
Make the title of this axis alone visible
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | x=linspace(0,1); %%%%% subplot-1 %%%%% subplot(2,2,1) plot(x,x) xlabel('input signal'); text(0,0.90,'$textcircled{bf a}$', 'Interpreter', 'latex'); %%%%% subplot-2 %%%%% subplot(2,2,2); plot(x,x.^2); xlabel('input signal'); text(0,0.90,'$textcircled{bf b}$', 'Interpreter', 'latex'); %%%%% subplot-3 %%%%% subplot(2,2,3) plot(x,x.^3); xlabel('input'); text(0,0.90,'$textcircled{bf c}$', 'Interpreter', 'latex'); %%%%% subplot-4 %%%%% subplot(2,2,4); plot(x,x.^4); xlabel('input'); text(0,0.90,'$textcircled{bf d}$', 'Interpreter', 'latex'); % Create a common title for all the subplots set(gcf,'NextPlot','add'); axes; set(gca,'Visible','off'); h = title('Common title for all subplots','fontweight','b'); set(h,'Visible','on'); |
suptitle() can also be used to create common title for all subplots instead Line 23-27 in the above code. But the above code gives more flexibility in setting title options.