|
From: John H. <jdh...@ac...> - 2004-09-13 22:37:31
|
Chris> Hi, I have looked had a look around but I have been unable
Chris> to find out how to change the size (and orientation) of
Chris> graphs when I save them as eps or png files - using savefig
Chris> - any help or directions to help would be greatly
Chris> appreciated.
The flags you are looking for a re the figsize argument to the figure
command, and the orientation flag to the savefig command. Complete
docstrings below.
I didn't write the landscape support for PS/EPS (there is none
currently for png), but I think the following incantation is what you
are looking for
from matplotlib.matlab import *
figure(figsize=(11, 8.5))
plot([1,2,3])
savefig('temp.ps', orientation='landscape')
show()
Docstring:
figure(num = 1, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
Create a new figure and return a handle to it
If figure(num) already exists, make it active and return the
handle to it.
figure(1)
figsize - width in height x inches; defaults to rc figure.figsize
dpi - resolution; defaults to rc figure.dpi
facecolor - the background color; defaults to rc figure.facecolor
edgecolor - the border color; defaults to rc figure.edgecolor
rcParams gives the default values from the .matplotlibrc file
3 >>> savefig?
Type: function
Base Class: <type 'function'>
String Form: <function savefig at 0x414504fc>
Namespace: Interactive
File: /usr/local/lib/python2.3/site-packages/matplotlib/matlab.py
Definition: savefig(*args, **kwargs)
Docstring:
def savefig(fname, dpi=150, facecolor='w', edgecolor='w',
orientation='portrait'):
Save the current figure to filename fname. dpi is the resolution
in dots per inch.
Output file types currently supported are jpeg and png and will be
deduced by the extension to fname
facecolor and edgecolor are the colors os the figure rectangle
orientation is either 'landscape' or 'portrait' - not supported on
all backends; currently only on postscript output.
Hope this helps,
JDH
|