Distribute figures

This function can distribute figures on different parts of the screen(s).
2.9K Downloads
Updated 31 Mar 2015

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Are you tired of moving your figures around to see them all? This function does it all for you! It can distribute in all parts of the screen, include Simulink figures or not and a whole lot more! It also supports secondary monitor(s) where the figures can be distributed.
>>>> A sample image can be found here: http://oi60.tinypic.com/9amydc.jpg <<<<<
The function calls needed to distribute in the shown pattern above is only:

distFig('Pos','NW','Only',1);
distFig('Pos','SW','Cols',3,'Only',(2:4));
distFig('Pos','NE','Rows',2,'Only',5);
distFig('Pos','NE','Rows',2,'Cols',2,'Only',[6,7],'Offset',2,'transpose',true);
distFig('Pos','SE','Rows',2,'Cols',4,'Only',(8:11));
distFig('Pos','SE','Rows',3,'Cols',2,'Not',(1:11),'Offset',3);

(Don't worry - it looks complicated, but by executing distFig(); the figures will also be nicely distributed. :) ) Also, there are two tutorials included to guide you through the various features.

The function supports all resolutions (also different resolutions on different monitors). It has been made using MATLAB 2015a and will thus not work properly for version 2014a and previous due to the changes in the figure handle system in version 2014b a newer releases.

The function also detects new updates automatically, but this feature is very beta, so it might contain bugs. It can easily be disabled without affecting the function, if it causes problems. Please report any errors encountered with the function. :)

Syntax:

distFig(...,'Screen',Value)
distFig(...,'Position',Value)

distFig(...,'Rows',Value)
distFig(...,'Columns',Value)

distFig(...,'Not',Value)
distFig(...,'Only',Value)
distFig(...,'Offset',Value)

distFig(...,'Adjust',Value)
distFig(...,'Extra',Value)
distFig(...,'Menu',Value)
distFig(...,'Transpose',Value)
distFig(...,'Simulink',Value)
distFig(...,'Tight',Value)
distFig(...,'Scale',Value)
distFig(...,'ScaleOrigin',Value)
distFig(...,'FreezeSize',Value)
distFig(...,'Order',Value)

Description:

distFig(...,'Screen',Value) assigns where the figures will be distributed. Synonyms for 'Screen' are 'Scr' and 'S'. Value can be:
'C' / 'Center' (Default)
'W' / 'West' / 'L' / 'Left'
'E' / 'East' / 'R' / 'Right'
'N' / 'North' / 'T' / 'Top'
'S' / 'South' / 'B' / 'Bottom'
'Main' / 'Primary'
'Ext' / 'External' / 'Secondary'

distFig(...,'Position',Value) assigns in which part of the screen the figures will be distributed. Synonyms for 'Position' are 'Pos' and 'P'. Value can be:
'C' / 'Center' (Default)
'W' / 'West' / 'L' / 'Left'
'E' / 'East' / 'R' / 'Right'
'N' / 'North' / 'T' / 'Top'
'S' / 'South' / 'B' / 'Bottom'
'NW'
'NE'
'SW'
'SE'

distFig(...,'Rows',Value) assigns how many rows the figures will be distributed on. Synonyms for 'Rows' are 'R'. Value can be:
1...n
'Auto' / -1
'Auto' indicates that it automatically calculates the number of required rows.

distFig(...,'Columns',Value) assigns how many rows the figures will be distributed on. Synonyms for 'Columns' are 'Cols' and 'C'. Value can be:
1...n
'Auto' / -1
'Auto' indicates that it automatically calculates the number of required columns.

distFig(...,'Not',Value) excludes specified figures from the distribution list. Value must be an array with the excluded figure numbers. The default value is []. The input argument 'gcf' (get current figure) can be used as well.

distFig(...,'Only',Value) does only distribute specified figures. Value must be an array with the figure which will be distributed. The default value is []. The input argument 'gcf' (get current figure) can be used as well.

The remaining features are described in the file.

Cite As

Anders Simonsen (2024). Distribute figures (https://www.mathworks.com/matlabcentral/fileexchange/37176-distribute-figures), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Migrate GUIDE Apps in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.17.0.0

Fixed a minor bug with the 'only' and 'not' features when using the 'gcf' input.

1.16.0.0

Added support for 'gcf' (get current figures) when using the 'only' and 'not' features.
Added features: 'Scale', 'ScaleOrigin', 'FreezeSize' and 'Order'.
Added additional warnings if external monitor(s) cannot be found.
Minor bug fixes.

1.15.0.0

Added a second tutorial and added an 'Adjust' feature.

1.14.0.0

Fixed a minor bug causing incorrect detection of primary monitor.

1.13.0.0

Added a tutorial file.

1.12.0.0

Added improved relative monitor detection.
Added exceptions for special function calls, which caused errors.
Fixed minor bugs.
Added automatically update feature system (First attempt of doing so, so it might cause bugs - please report these)

1.11.0.0

The function has been updated to support the new figure handle system of 2014b and 2015a (Prerelease). Minor bugs have been fixed as well.

1.10.0.0

Fixed a minor bug with the new figure handle system of 2014b.

1.9.0.0

Added support for the 2014b (pre)release. Also fixed a minor problem with the 'Units' property of the current axes.

1.8.0.0

Updated description

1.7.0.0

The whole function has been updated to support different screen resolutions along with other useful features.

1.6.0.0

A minor update

1.5.0.0

Added a few lines to the description.

1.3.0.0

Added the 'Rows' and 'Offset' properties and changed the input mode a more logical way.

1.2.0.0

Removed a misplaced "nargin".

1.0.0.0