Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Subplots with one title

Subject: Subplots with one title

From: Hannes Bauer

Date: 13 Feb, 2009 08:15:21

Message: 1 of 15

Hello!

Is it possible to make a figure consisting of subplots with one title on top of all subplots instead of one title for each subplot?

Regards,

Subject: Subplots with one title

From: Dave Brackett

Date: 13 Feb, 2009 09:53:01

Message: 2 of 15

"Hannes Bauer" <pixstamp@gmx.net> wrote in message <gn3a6p$juk$1@fred.mathworks.com>...
> Hello!
>
> Is it possible to make a figure consisting of subplots with one title on top of all subplots instead of one title for each subplot?
>
> Regards,


just title the top subplot, e.g.

figure
a=subplot(2,1,1)
b=subplot(2,1,2)
title(a,'title')

Subject: Subplots with one title

From: DanF211

Date: 13 Feb, 2009 10:50:03

Message: 3 of 15

"Dave Brackett" <davebrackett@hotmail.com> wrote in message <gn3ftt$bh0$1@fred.mathworks.com>...
> "Hannes Bauer" <pixstamp@gmx.net> wrote in message <gn3a6p$juk$1@fred.mathworks.com>...
> > Hello!
> >
> > Is it possible to make a figure consisting of subplots with one title on top of all subplots instead of one title for each subplot?
> >
> > Regards,
>
>
> just title the top subplot, e.g.
>
> figure
> a=subplot(2,1,1)
> b=subplot(2,1,2)
> title(a,'title')

That doesn't really work if there are four subplots because the title will be above the first one, i.e. on the left. It would be nice to have a way of putting the title at the top centre of the figure, regardless of the number/configuration of subplots.

Subject: Subplots with one title

From: Dave Brackett

Date: 13 Feb, 2009 11:26:02

Message: 4 of 15

"DanF211 " <daniel.cromb@iop.kcl.ac.uk> wrote in message <gn3j8r$qdg$1@fred.mathworks.com>...
> "Dave Brackett" <davebrackett@hotmail.com> wrote in message <gn3ftt$bh0$1@fred.mathworks.com>...
> > "Hannes Bauer" <pixstamp@gmx.net> wrote in message <gn3a6p$juk$1@fred.mathworks.com>...
> > > Hello!
> > >
> > > Is it possible to make a figure consisting of subplots with one title on top of all subplots instead of one title for each subplot?
> > >
> > > Regards,
> >
> >
> > just title the top subplot, e.g.
> >
> > figure
> > a=subplot(2,1,1)
> > b=subplot(2,1,2)
> > title(a,'title')
>
> That doesn't really work if there are four subplots because the title will be above the first one, i.e. on the left. It would be nice to have a way of putting the title at the top centre of the figure, regardless of the number/configuration of subplots.


ok, you could use text(x,y,'string') to create a text string on the figure. just would need to get the x and y coordinates for positioning. You could link the x coordinates to the size of the figure window so that it is always in the middle.

Subject: Subplots with one title

From: Dave Brackett

Date: 13 Feb, 2009 11:36:01

Message: 5 of 15

"Dave Brackett" <davebrackett@hotmail.com> wrote in message <gn3lc9$j8g$1@fred.mathworks.com>...
> "DanF211 " <daniel.cromb@iop.kcl.ac.uk> wrote in message <gn3j8r$qdg$1@fred.mathworks.com>...
> > "Dave Brackett" <davebrackett@hotmail.com> wrote in message <gn3ftt$bh0$1@fred.mathworks.com>...
> > > "Hannes Bauer" <pixstamp@gmx.net> wrote in message <gn3a6p$juk$1@fred.mathworks.com>...
> > > > Hello!
> > > >
> > > > Is it possible to make a figure consisting of subplots with one title on top of all subplots instead of one title for each subplot?
> > > >
> > > > Regards,
> > >
> > >
> > > just title the top subplot, e.g.
> > >
> > > figure
> > > a=subplot(2,1,1)
> > > b=subplot(2,1,2)
> > > title(a,'title')
> >
> > That doesn't really work if there are four subplots because the title will be above the first one, i.e. on the left. It would be nice to have a way of putting the title at the top centre of the figure, regardless of the number/configuration of subplots.
>
>
> ok, you could use text(x,y,'string') to create a text string on the figure. just would need to get the x and y coordinates for positioning. You could link the x coordinates to the size of the figure window so that it is always in the middle.

actually, scrub that last comment, you can't use that as that only puts text within an axes, and while you could create an invisible axes the same size as the figure, it would probably be a bit of a pain.

however, there is this function on the file exchange called supertitle which should do what you want: http://www.mathworks.com/matlabcentral/fileexchange/3233

Subject: Subplots with one title

From: Adam A

Date: 11 Mar, 2010 13:58:25

Message: 6 of 15

> however, there is this function on the file exchange called supertitle which should do what you want: http://www.mathworks.com/matlabcentral/fileexchange/3233

The function 'supertitle' doesn't seem to exist in the file exchange any more.

However, the function 'mtit' does the job quite nicely instead:
http://www.mathworks.com/matlabcentral/fileexchange/3218-mtit-a-pedestrian-major-title-creator

Subject: Subplots with one title

From: Arseny

Date: 20 Jul, 2011 00:30:19

Message: 7 of 15

If the subplots don't have titles of their own, this simple code seems to work:

set(gcf,'NextPlot','add');
axes;
h = title('MyTitle');
set(gca,'Visible','off');
set(h,'Visible','on');

Subject: Subplots with one title

From: Paw

Date: 13 Mar, 2013 12:40:07

Message: 8 of 15

> set(gcf,'NextPlot','add');
> axes;
> h = title('MyTitle');
> set(gca,'Visible','off');
> set(h,'Visible','on');

Worked like a charm. Thanks.

Subject: Subplots with one title

From: Mircea

Date: 5 Jun, 2013 14:59:09

Message: 9 of 15

If your subplots have titles, you could try
suptitle, instead title

doc suptitle for details

Subject: Subplots with one title

From: Erol

Date: 10 Jun, 2013 11:56:08

Message: 10 of 15

"Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
> If your subplots have titles, you could try
> suptitle, instead title
>
> doc suptitle for details

Yes - that's a handy command right there.

Subject: Subplots with one title

From: Trevor

Date: 6 Feb, 2014 21:45:11

Message: 11 of 15

"Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
> If your subplots have titles, you could try
> suptitle, instead title
>
> doc suptitle for details

suptitle for the win! Definitely what I was looking for to easily add a title to a 2x2 subplot, thanks!

Subject: Subplots with one title

From: Giovanni de amici

Date: 19 May, 2014 17:07:13

Message: 12 of 15

"Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
> If your subplots have titles, you could try
> suptitle, instead title
>
> doc suptitle for details

my installation of Matlab (r2013b, 8.2.0.701 on a mac) does not know what 'suptitle' is.
does that command come with one of the additional toolboxes?

Subject: Subplots with one title

From: dpb

Date: 19 May, 2014 17:15:56

Message: 13 of 15

On 5/19/2014 12:07 PM, Giovanni de amici wrote:
> "Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
>> If your subplots have titles, you could try
>> suptitle, instead title
>>
>> doc suptitle for details
>
> my installation of Matlab (r2013b, 8.2.0.701 on a mac) does not know
> what 'suptitle' is.
> does that command come with one of the additional toolboxes?

Don't know it, either...there's _suplabel_ submission on the File
Exchange...maybe it's what the other respondent's thinking of.

<http://www.mathworks.com/matlabcentral/fileexchange/7772-suplabel>

--

Subject: Subplots with one title

From: Omar Mian

Date: 22 May, 2014 22:33:08

Message: 14 of 15

"Giovanni de amici" <giovanniremove.thisdeamicireplace@thatnasa.gov> wrote in message <llddo0$cg8$1@newscl01ah.mathworks.com>...
> "Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
> > If your subplots have titles, you could try
> > suptitle, instead title
> >
> > doc suptitle for details
>
> my installation of Matlab (r2013b, 8.2.0.701 on a mac) does not know what 'suptitle' is.
> does that command come with one of the additional toolboxes?

I find suptitle.m here: C:\Program Files (x86)\MATLAB\R2012b\toolbox\bioinfo\biodemos\
I'm assuming this is the bioinformatics toolbox.

Subject: Subplots with one title

From: dpb

Date: 22 May, 2014 22:43:25

Message: 15 of 15

On 5/22/2014 5:33 PM, Omar Mian wrote:
> "Giovanni de amici" <giovanniremove.thisdeamicireplace@thatnasa.gov>
> wrote in message <llddo0$cg8$1@newscl01ah.mathworks.com>...
>> "Mircea" wrote in message <konjnt$mfp$1@newscl01ah.mathworks.com>...
>> > If your subplots have titles, you could try
>> > suptitle, instead title
>> > > doc suptitle for details
>>
>> my installation of Matlab (r2013b, 8.2.0.701 on a mac) does not know
>> what 'suptitle' is.
>> does that command come with one of the additional toolboxes?
>
> I find suptitle.m here: C:\Program Files
> (x86)\MATLAB\R2012b\toolbox\bioinfo\biodemos\
> I'm assuming this is the bioinformatics toolbox.

Ayup, that it is...interesting place to find such a likely useful tool.
  Who can explain the myriad mysteries of TMW and Matlab bundling???

--

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us