Python: A4 size for plot

I have code that saves a shape with:

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

If I do not specify anything, the number will be saved correctly, but when I print it, the figure fills only half of the A4 sheet. If I change the line as:

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

Doesn’t touch anything! How to set the size of the figure so that it fills the entire sheet A4? Thank you very much in advance.

+8
python matplotlib
source share
1 answer

Try setting the size of the shape (in inches) before you save it. You can do this when you initialize the shape 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 schedules using

 rc('figure', figsize=(11.69,8.27)) 
+17
source share

All Articles