View License

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

» Watch video

Highlights from

5.0 | 6 ratings Rate this file 19 Downloads (last 30 days) File Size: 3.91 KB File ID: #38581 Version: 1.1



Brendan (view profile)


11 Oct 2012 (Updated )

MATLAB function for tiling figures on the screen.

| Watch this File

File Information

Inspired by , but with a number of improvements. User can choose which figures to tile, can resize or not, can specify a number of rows and/or columns, can specify a spacing between the figures, and can specify a sub-portion of the monitor to be used.

tilefigs also allows tiling on a dual monitor, though MATLAB does not (at present) officially support multiple monitors, and so some manual effort may be required.


This file inspired Eurostat Data Downloading Facility and Arrange Figures( Handles ).

Required Products MATLAB
MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
20 Feb 2016 John Smith

Great utility!
There's a problem, though:
The program changes figure units to 'pixels' while running and reverts back to whatever units the figure had.
However, since the units were changed from 'normalized', resizing of the figure does not resize text, labels, etc. Therefore, they get clipped.
It'd much better to operate with 'normalized' units.

Comment only
15 Dec 2015 Arnold

Arnold (view profile)

Thank you!! Pico's suggestion also works great on my linux machine.

31 Aug 2015 Michael Smirnov

Thanks for a great function!
Note - For those who are in search of a function which is optimized for tiling figures of different sizes, you might want to try my arrangeFigures

Comment only
22 Oct 2014 eduardo Schenberg

i love this function, but all of a sudden now I got the following error (which I can not understand nor solve):

Error using set
Width and height must be > 0
Error in tilefigs (line 169)
set(handles(pnum),'OuterPosition',[xLocation yLocation width height]);

I appreciate any help! working in matlab R2013b ( in mac OS 10.9.4


Comment only
16 Oct 2014 Peter Pablo

15 May 2014 alejandro castro

Works very well as described on my linux machine.

12 Dec 2013 Rico

Rico (view profile)

Thanks for this nice function!

There is one problem, though, when you are running matlab in linux. In this case 'MonitorPositions' has a different meaning (see

Thus, linux users need to replace

matlabMonitorSize = monitorPositions(:,3:4) - monitorPositions(:,1:2) + 1;


matlabMonitorSize = monitorPositions(:,3:4);

Comment only
12 Sep 2013 Jonathan

I love this function, it is very useful and works well.

My only issue is that (as you describe in the comments) it does not correctly position the figures on multi-monitor setups. This is because get(0,'MonitorPositions') returns the monitor boundaries in 'display' coordinates with (1,1) at the upper left corner of monitor 1, while figure positions start at the lower left corner.

If you replace your definition of 'matlabMonitorLocation' with:
matlabMonitorLocation = [monitorPositions(:,1) (monitorPositions(1,4) - monitorPositions(:,4) + 1)];

it works perfectly (at least on my 4 monitor Windows 7 setup on MATLAB R2013a).

02 Jun 2013 Brendan

Brendan (view profile)

Anne, to fix the fact that the images don't go all the way down the screen, you can edit the default border.

% Set the default border if none is specified [left, bottom, right, top]
if monitor > 1
if ~exist('border','var') || isempty(border)
border = [0 0 0 0];
if ~exist('border','var') || isempty(border)
border = [0 30 0 0];

Change the second border to [0 0 0 0]

Are you setting resize to false? If not, I don't understand the issue with the figure overlap. Tilefigs uses the "outer position" information from the figure handle, so either there is an error in my math somewhere, or matlab does not compute the outer position of the figures properly. A hack to fix this would be to add in a leftRightSpacing ( or topBottomSpacing), though I agree it's not ideal.

Comment only
02 Jun 2013 Anne

Anne (view profile)

Great function—thank you for sharing it!

The only issue for me (I'm on Mac OS 10.6.8) is that there is some overlap between the windows, and they don't go quite all the way down to the bottom of the screen. But that's a very minor thing—otherwise it works great.

15 May 2013 Alexandre Willame

Awesome function! I now use it a nearly all my simulations. You can very easily sort your figure just by doing (for example):

h(1) = figure();
h(2) = figure();
h(3) = figure();
h(4) = figure();
h(5) = figure();


And that's it! All your figures are placed correctly on the screen so you can analyse easily and conveniently all your results. A must have.

05 Dec 2012 Brendan

Brendan (view profile)

Updated to allow for non-pixel units for figures

Comment only
05 Dec 2012 1.1

Changed to allow arbitrary figure units (instead of forcing pixels)

Contact us