Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

figure without the white border

495 views
Skip to first unread message

cbsmi...@gmail.com

unread,
Feb 27, 2007, 12:44:03 PM2/27/07
to
Does anyone know how to save a matlab plot as an image without the
extra white border? When saving a figure as an image (eps, tif, jpg),
matlab appends an extra border around the plotting area (white in my
case, but I think that's configurable). I end up opening every image
with gimp and autocropping it.

For actual images, i can do an imwrite of the data. But for a normal
plot or if I've drawn something on the image, matlab always appends
the border that is just too large (imo). Is there a trick to get rid
of it?

thanks for any suggestions!
chris

Carlos López

unread,
Feb 27, 2007, 3:40:23 PM2/27/07
to
you might try something like:

<plot what you want here>
set(gca,'position',[0 0 1 1],'units','normalized')

Regards
Carlos

cbsmi...@gmail.com

unread,
Feb 27, 2007, 7:02:50 PM2/27/07
to

Great! That works! Simple and elegant.
Thanks,
chris

cbsmi...@gmail.com

unread,
Feb 27, 2007, 7:12:53 PM2/27/07
to
Well actually that cuts off any axis labels too, but its a start.
Works great for images though.

chris

J. Luis

unread,
Feb 27, 2007, 7:47:32 PM2/27/07
to
cbsmith724 wrote:
>
>
> Well actually that cuts off any axis labels too, but its a start.
> Works great for images though.

imcrop (in FEX)

Shamir Alavi

unread,
Nov 6, 2012, 2:12:08 PM11/6/12
to
"Carlos López" <clv2clv@_$$$$$$$$$$$$$$$_adinet.com.uy> wrote in message <ef4e...@webcrossing.raydaftYaTP>...
I know this is a very old post and you must have figured out several ways to do it, but in case somebody else is wondering about it, here's a nifty trick to go totally borderless. Just write this line in the command window or add it to you code:

iptsetpref('ImshowBorder','tight');

source: http://www.shawnlankton.com/2007/06/matlab-figures-without-borders-and-toolbars/

Philip Mannering

unread,
Jul 23, 2014, 8:31:11 AM7/23/14
to
"Carlos López" <clv2clv@_$$$$$$$$$$$$$$$_adinet.com.uy> wrote in message <ef4e...@webcrossing.raydaftYaTP>...
Fantastic!

mohamed

unread,
Mar 23, 2016, 10:35:11 AM3/23/16
to
Great !! Thanks

Benjamin Bartelle

unread,
Sep 4, 2016, 8:47:10 PM9/4/16
to
This is the only one that worked for me. I was exporting very small 24X24p images to assemble into a montage.

> Use the following command
> set(gca,'LooseInset',get(gca,'TightInset'));

Lorenzo

unread,
Oct 3, 2016, 8:11:07 PM10/3/16
to
"Carlos López" <clv2clv@_$$$$$$$$$$$$$$$_adinet.com.uy> wrote in message <ef4e...@webcrossing.raydaftYaTP>...
Hi,

So I put this in my code, but It seems to have jumbled up the rest of the code because of the image sizes.

What would I do to let it go back to default? To put back that white border again?

Thanks
0 new messages