From: Mark Aull on
saneman <yyyy(a)dd.com> wrote in message <fjrncv$sd8$1(a)news.net.uni-c.dk>...
> I make this subplot of two images:
>
> subplot(1,2,1)
> imagesc(uint8(square)); colormap(gray(256));
> axis image; axis off; title('square1');
>
> subplot(1,2,2)
> imagesc(uint8(square)); colormap(gray(256));
> axis image; axis off; title('square2');
>
> But the gray area around the images is rather large. When I save the
> plot as a .png file and include it in my LaTeX file a lot of space is
> wasted.
>
> Is there some way to minimize the gray area without minimizing each image?

For anyone attempting to follow the previous instructions for modifying the subplot function, it is also necessary to reset the variable def_pos to [0,0,1,1] after about line 237 (and comment out the code setting it if you care about efficiency).
From: Pekka Kumpulainen on
"Mark Aull" <asd(a)asd.com> wrote in message <hvrqi3$2p5$1(a)fred.mathworks.com>...
> saneman <yyyy(a)dd.com> wrote in message <fjrncv$sd8$1(a)news.net.uni-c.dk>...
> > I make this subplot of two images:
> >
> > subplot(1,2,1)
> > imagesc(uint8(square)); colormap(gray(256));
> > axis image; axis off; title('square1');
> >
> > subplot(1,2,2)
> > imagesc(uint8(square)); colormap(gray(256));
> > axis image; axis off; title('square2');
> >
> > But the gray area around the images is rather large. When I save the
> > plot as a .png file and include it in my LaTeX file a lot of space is
> > wasted.
> >
> > Is there some way to minimize the gray area without minimizing each image?
>
> For anyone attempting to follow the previous instructions for modifying the subplot function, it is also necessary to reset the variable def_pos to [0,0,1,1] after about line 237 (and comment out the code setting it if you care about efficiency).

This is the reason I haven't used subplot for quite a while. I wrote my own function tight_subplot for easy control on the space between and around the plots.
Bringing up this topic motivated me to finally write a short help section and submit it to the FEX. "quick hack for my own use" but it could be useful for somebody anyway.