resize figure window

  • Follow


Lets say I do this:
p=rand(50,50); % create random array
imagesc(p); % create figure
axis(equal); % set axis equal

Then there is white space around the edges of the figure. I can use the mouse to make the figure narrower and then the white space will go away if I get it exactly right. Which is good because then I want to use the figure in Powerpoint, by using Copy Figure, and Paste.

How could I set the figure to the right width in a Matlab script? I tried setting the figure position but this did not work exactly the same as using the mouse. It actually cut off some of the image.
Also when you use "Copy Figure" and then paste in Powerpoint, there is a lot of white space around the image. Any way to avoid that?

Thanks Matt
0
Reply Matt 12/22/2009 2:03:03 AM

How about 

>>axis image

or setting the xlim?
0
Reply Matt 12/22/2009 2:41:02 AM


Matt:
You need to set the "Position" property of the axes, not the figure.
Run this demo and it will demonstrate it for you:

p=rand(50,50); % create random array
imagesc(p); % create figure
axis('equal'); % set axis equal
screenSize = get(0,'Screensize')
set(gcf, 'Position', screenSize); % Maximize figure
axesSize = get(gca, 'Position')

uiwait(msgbox('Click OK to shrink the axes'));
axesSize1 = axesSize;
axesSize1(3:4) = 0.5 * [axesSize(3) axesSize(4)];
set(gca, 'Position', axesSize1); % Shrink figure

uiwait(msgbox('Click OK to enlarge the axes'));
axesSize2 = axesSize;
axesSize2(3:4) = 1.09 * [axesSize(3) axesSize(4)];
set(gca, 'Position', axesSize2); % Enlarge figure
0
Reply ImageAnalyst 12/22/2009 4:28:51 AM

2 Replies
810 Views

(page loaded in 0.047 seconds)

Similiar Articles:













7/24/2012 12:17:21 AM


Reply: