Remove white space from figures in MATLAB
Today I was struggling again with those annoying white spaces around the figures in MATLAB when you convert the figure to EPS, TIFF, PNG, JPEG or any other format. After some time, I discover the LooseInset property. This command will remove the white spaces and tight the image borders.
set(gca,'LooseInset',get(gca,'TightInset'))
So, this will make the process of creating EPS figures in MATLAB easier. Sadly, it only work for square figures.
Hope that helps.
Categories: MATLAB, Tips
Crop, Figures, Tight Borders, White space





Warning: this will not work if your figure is not square. It will tighten it to a smaller square dimension, leaving you with white space along the smaller of your figure’s actual dimensions. I still don’t know how to change the mat size for the figure to be something not square.
Yes, you are right. I’m working in images again and find the problem you just mention.
I found one solution in here.
http://www.shawnlankton.com/2007/06/matlab-figures-without-borders-and-toolbars/comment-page-1/#comment-2101
Dear Adin,
Thanks a lot for your valuable information on Matlab plots.
I was struggling with this for quite some time.
-satya