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.
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.
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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With