From: Patrick Conley on
Hi;
I'm new to Matlab. I'm trying to work out how to export figures, and I'm having trouble with their sizes. I'm using plot commands like

x = 1:0.1:100;
plot( sin(x) )
% resizing commands
print -depsc 'matlab.eps'

The resizing commands I've been trying to use are

set( gcf, 'Units', 'inches', 'Position', [ 0, 0, 7.3, 7.3 ] )

which creates the plot, but without preserving the size---the resulting paper size is 6.68 x 5.19 inches, irrespective of the width and height in 'Position', and whether or not I set the 'PaperSize' property to something else. The second command I've been trying is

set( gca, 'Units', 'inches', 'Position', [ 0, 0, 7.3, 7.3 ] )

which creates a plot of the correct size, but truncates it to some seemingly arbitrary paper size---7.47 x 6.07 inches for the dimensions above, and 8 x 6 inches for anything larger; again, irrespective of the 'PaperSize' property.

The 'Save as' menu item in the figure window, of course, creates the plots exactly as I'd like to see them, but because these commands are all going to go in a batch script, I don't have the option of using it.

Cheers,
Patrick
From: Rune Allnor on
On 5 Jun, 02:03, "Patrick Conley" <patn...(a)pipcom.com> wrote:
> Hi;
> I'm new to Matlab. I'm trying to work out how to export figures, and I'm having trouble with their sizes. I'm using plot commands like
>
> x = 1:0.1:100;
> plot( sin(x) )
> % resizing commands
> print -depsc 'matlab.eps'
>
> The resizing commands I've been trying to use are
>
> set( gcf, 'Units', 'inches', 'Position',  [ 0, 0, 7.3, 7.3 ] )
>
> which creates the plot, but without preserving the size---the resulting paper size is 6.68 x 5.19 inches, irrespective of the width and height in 'Position', and whether or not I set the 'PaperSize' property to something else. The second command I've been trying is
>
> set( gca, 'Units', 'inches', 'Position', [ 0, 0, 7.3, 7.3 ] )

The figure property 'position' governs the appearance on the screen.
You need to control the appearance on paper. I usually do this with
a sequence along the lines of

set(gcf,'units','centimeters')
set(gcf,'papersize',[12,8])
set(gcf,'paperposition',[0,0,12,8])

Rune
From: Patrick Conley on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <9d03c811-aa3b-48d9-8439-5f6c63499d57(a)y11g2000yqm.googlegroups.com>...
> On 5 Jun, 02:03, "Patrick Conley" <patn...(a)pipcom.com> wrote:
> > Hi;
> > I'm new to Matlab. I'm trying to work out how to export figures, and I'm having trouble with their sizes. I'm using plot commands like
> >
> > x = 1:0.1:100;
> > plot( sin(x) )
> > % resizing commands
> > print -depsc 'matlab.eps'
> >
> > The resizing commands I've been trying to use are
> >
> > set( gcf, 'Units', 'inches', 'Position',  [ 0, 0, 7.3, 7.3 ] )
> >
> > which creates the plot, but without preserving the size---the resulting paper size is 6.68 x 5.19 inches, irrespective of the width and height in 'Position', and whether or not I set the 'PaperSize' property to something else. The second command I've been trying is
> >
> > set( gca, 'Units', 'inches', 'Position', [ 0, 0, 7.3, 7.3 ] )
>
> The figure property 'position' governs the appearance on the screen.
> You need to control the appearance on paper. I usually do this with
> a sequence along the lines of
>
> set(gcf,'units','centimeters')
> set(gcf,'papersize',[12,8])
> set(gcf,'paperposition',[0,0,12,8])
>
> Rune

Thanks, Rune. I wasn't aware of the distinction.

Patrick