Python: A4 size for a plot


I have a code that saves a figure with:

savefig("foo.eps", orientation = 'portrait', format = 'eps')

If I don't specify anythingelse, the figure is correctly saved but when I print it, the figure fills only the half of a A4 sheet.If I modify the string as:

savefig("foo.eps", papertype = 'a4', orientation = 'portrait', format = 'eps')

Nothing chages! How can I set the size of the figure in a way that it fills the whole A4 sheet? Many thanks in advance.

3/22/2013 1:13:55 PM

Accepted Answer

Try to set the size of the figure (in inches) before you save it. You can do this when you initialize the figure by doing:

figure(figsize=(11.69,8.27)) # for landscape

or if the figure exists:

f = gcf()  # f = figure(n) if you know the figure number

or in advance for all plots, using

rc('figure', figsize=(11.69,8.27))
3/25/2013 7:20:46 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow