Python: A4 size for a plot

Question:

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.

Asked By: Py-ser

||

Answers:

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
f.set_size_inches(11.69,8.27)

or in advance for all plots, using

rc('figure', figsize=(11.69,8.27))
Answered By: askewchan
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.