View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
mtit: a pedestrian major title creator

4.7 | 35 ratings Rate this file 191 Downloads (last 30 days) File Size: 2.36 KB File ID: #3218 Version: 1.1

mtit: a pedestrian major title creator


us (view profile)


01 Apr 2003 (Updated )

MTIT creates a major title in a figure with many axes

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

- creates a major title above all axes in a figure
- preserves the stack order of the axes

several options allow to fine-tune the position of the title and typical text property/value pairs may be used as additional input to further adjust its looks

> help mtit
for usage and a brief example for this small utility


This file inspired Figtitle and Mysubplot: Subplots With Major Title.

MATLAB release MATLAB 6.0 (R12)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (41)
09 Feb 2017 Narayanan Rengaswamy

01 Feb 2017 Xiao

Xiao (view profile)

01 Nov 2016 hong-liang sun

20 Sep 2016 Simone

Simone (view profile)

13 Apr 2016 Miles

Miles (view profile)

is there a way to turn off or erase the title once it's generated using mtit?

25 Mar 2016 Arda Aksu

you have some indent issues! :)

23 Feb 2016 Sven

Sven (view profile)

10 Dec 2015 Michael

25 Jun 2014 Robert

Robert (view profile)

Works great! NB. seems to be incompatible with new graphics in the 2014b release, hope you can modify it to sense the matlab release and operate accordingly.

23 Jun 2014 Greg

Greg (view profile)

12 Jun 2014 Vinitha

19 Apr 2014 Johann

Johann (view profile)

Awesome dude. Thanks. Works great.

13 Dec 2013 Béla

Béla (view profile)

Thank you! Works great!

02 Apr 2013 Adam

Adam (view profile)

Thanks. Great function, works well.

My only complaint is that line 136:


causes a figure's 'Visible' property to be set to 'on' (I had turned it off to save time and resources). A better solution might be:


which updates the current axis without changing the state of the parent figure, as documented in the help file for the "axes" command (doc axes). I don't know how that will affect the order of the figure's 'Children' property though.

Comment only
01 Mar 2013 Greg

Greg (view profile)

As Kris Thielemans points out, if you specify a Y offset without specifying an X offset, the value will be applied to the title's X offset. The user can circumvent the bug by specifying a 0 offset for x in the command call. The bug can be fixed in the code by moving line 155 ("io=io+1;") in the "get_off" function to before the if statement (say to a new line 154).

21 Dec 2012 Rafa Valero

Thanks, It works really well.

07 Sep 2012 Kris Thielemans

works nicely.

Only problem I see is with handling of the offset options. For example,


actually gives an xoffset. Seems you have to specify x,y offset in order.

03 May 2012 Andres

Andres (view profile)

To those who are asking about a second line in the title, or making just more space for it, that's easy, just use sprintf inside mtit, like this:
mtit(sprintf('LINE 1 \n LINE 2\n\n\n'))

By the way, I haven't used all the options, but at least for the basic stuff (title for a 2x2 figure) it works very well.

22 Apr 2012 n

n (view profile)

Can you please update it for a title input as a cell, where we can define more than a single line title as well?

Comment only
09 Mar 2012 Phil

Phil (view profile)

22 Feb 2012 yuvaraj

Its working fine

22 Feb 2012 yuvaraj

mtit ('Vz=25', 'FontWeight','bold');
when use this command to have a title for my subplots
It displays an error like the one shown below
??? Undefined function or method 'mtit' for input arguments of type 'char'.

Comment only
06 Feb 2012 Vahid

Vahid (view profile)

works nicely!

23 Nov 2011 Lakshmi Kolluru

its really nice and helped me do what i wanted.

Comment only
12 Apr 2011 Yoichi

Yoichi (view profile)

22 Mar 2011 Maikol Solís Chacón

15 Feb 2011 Heinri Brink

Ok, but this does not work for a two line title. I want to add a title with two lines as in title({Line1,Line2});

Comment only
19 Jan 2011 Joshua Kaizer

works very well

17 Jan 2011 Roland Pasto

26 Aug 2010 David

David (view profile)

A simple, handy function - thank you!

However, I had trouble with the 'xoff', 'yoff', etc. options. When specifying just one of these, the title moved horizontally no matter which of these offsets was entered. I exchanged lines 154 and 155 in the code:

if any(ix)

and now the offsets work individually or together.

26 May 2010 Pawel S

Very easy to handle. It did exaclty what I wanted. Thx!

11 Mar 2010 Adam A

Adam A (view profile)

Does the job nicely, thanks.

26 Nov 2009 shlomix

shlomix (view profile)

13 Nov 2009 us

us (view profile)

this happens by design:
after MTIT terminates, the current (active) axis (GCA) is the handle of the invisible surrounding axis created by MTIT...
i've changed this behavior and an update should show up soon...
in the meantime, you can use this (tedious) approach
% create your figure/axes
cah=gca; % <- save current axis handle
axes(cah); % <- reset current axis handle


Comment only
09 Nov 2009 sophie neve

I got a problem with it... makes the rotation of 3D surf impossible....

17 Sep 2008 Dave Watts

Nice but to be really good the rest of the plot needs to be moved to create space for the title

15 Apr 2008 Mark Gregor

Great work, good to have it.

07 Feb 2008 Heesun Kiem

This is one I have been looking. It is very useful. Thanks.

29 Jan 2008 Tom Fitzpatrick

nice one, just what i was looking for

11 Apr 2006 p kung

07 Jan 2006 Madhusudhanan Balasubramanian

07 Apr 2003

1) additional buil-in title modifier pairs
2) uses GCF by default
3) restores axes units that are not normalized

13 Nov 2009 1.1

MTIT now preserves the stack of axis handles and returns in GCA the last used axis; version tag 13-Nov-2009 17:38:17

Contact us