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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Teemu
on 28 Feb 2013

How can I subplot images close to eachother using subplot? Now I have plotted 20 images to same figure and space between images is too big.

*No products are associated with this question.*

Answer by Jan Simon
on 28 Feb 2013

Edited by Jan Simon
on 28 Feb 2013

Accepted answer

As usual it is a good idea to look in Matlab's FileExchange before asking in the forum. Standard problems have been solved by others before most likely:

- http://www.mathworks.com/matlabcentral/fileexchange/40024-arrangesubplots
- http://www.mathworks.com/matlabcentral/fileexchange/39664-subtightplot
- http://www.mathworks.com/matlabcentral/fileexchange/38420-bigsubplot
- http://www.mathworks.com/matlabcentral/fileexchange/35464-spaceplots
- http://www.mathworks.com/matlabcentral/fileexchange/35435-gettightsubplothandles
- http://www.mathworks.com/matlabcentral/fileexchange/34191-subplotgrid
- http://www.mathworks.com/matlabcentral/fileexchange/34594-subplotplus-enhanced-layout-matlab-subplot-function
- ...

Answer by Daniel
on 28 Feb 2013

Copy subplot.m and edit line 128 (or there abouts)

inset = [.02, .018, .004, .01]; % [left bottom right top]

to be values more to your liking. Either save the new file as subplot.m (which will affect all subplots) or something new (e.g., tightsubplot) and use that when you want tight subplots.

## 0 Comments