Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 695
Py-ser Avatar asked Mar 22 '13 13:03

Py-ser


People also ask

What is PLT figure size?

figsize() takes two parameters- width and height (in inches). By default the values for width and height are 6.4 and 4.8 respectively. Syntax: plt.figure(figsize=(x,y)) Where, x and y are width and height respectively in inches.


1 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)) 
like image 143
askewchan Avatar answered Sep 21 '22 20:09

askewchan