File Exchange

image thumbnail


version 1.0 (1.59 KB) by

Shrink or expand the spacing between subplots in a figure.



View License

The spacing between subplots takes up a lot of space, which I would like to use to show my results. I wrote subplotSpacing.m to shrink the spacing between subplots, and thus increase the relative area occupied by the figures. subplotSpacing.m can also be used expand the spacing between subplots. It just depends on the value of the 'space' input.

Comments and Ratings (3)


Karl (view profile)

This doesn't work if you combine subplots - line 18 in the code catches it as an error. For example:
subplot(2,2,[3 4]);plot(x3,y3);
MATLAB returns:
Error using subplotSpacing (line 18)
dimensions of subplot do not match number of elements of h

I tried using it for a several figures with different number of rows an columns and it keeps making them even smaller and dragging them to the left bottom corner. I don't know if it's my matlab version (v. 7, yr 2004) or sth else.

James Edwards

Thanks for this, very nice and easy to use.

I have only a 1 row and 2 column subplot, so I got an error in 'pull rows together section'. I just put "if numrows > 1" around it and it worked fine.

MATLAB Release
MATLAB 7.7 (R2008b)

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

» Watch video