is it possible to define global title on figures?

P
prashantgujjar370 · Feb 12, 2020 · 2.2K views
Question
I have subplots with titles, but I want to add a title to the whole figure. Is it possible?
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Nov 20, 2025

Yes this is possible by creating a new axes which takes up much of the figure. Then a title for this axes. Turning the axes Visible property 'off' will make the axes "disappear", but the title will inherit this property and you will need to turn the Visible property for the title back 'on'.

x = 0:0.001:2*pi;
y1 = cos(x);
y2 = sin(x);
f = figure;
subplot(2,1,1)
plot(x,y1)
subplot(2,1,2)
plot(x,y2)
a = axes;
t1 = title('Global Title');
a.Visible = 'off'; % set(a,'Visible','off');
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!