Home > MATLAB, Tips > Remove white space from figures in MATLAB

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. :mrgreen:

About these ads
  1. Matt
    September 15, 2011 at 2:38 am

    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.

  2. September 15, 2011 at 4:03 pm

    Yes, you are right. I’m working in images again and find the problem you just mention.
    I found one solution in here.

  3. abdalbassir
  4. March 15, 2013 at 2:46 pm

    Dear Adin,

    Thanks a lot for your valuable information on Matlab plots.

    I was struggling with this for quite some time.

    -satya

  5. June 23, 2013 at 11:35 pm

    Fastidious answer back in return of this matter with
    firm arguments and telling all regarding that.

  6. Jayne
    August 1, 2013 at 2:46 am

    Thank you!!!! Works great and is going to save me a ton of time.

  1. August 17, 2011 at 9:07 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: