On 25/06/12 18:30, Benjamin Root wrote: > > > > Your call to "plt.subplots" is creating a new figure object, which > never gets the figsize parameter (only the old figure object has that > set). > > Cheers! > Ben Root >
Hi, indeed you are right. I added "f.set_size_inches(fig_size)" and it works Also I had a wrong conversion of inch to cm (2.58 before). Thank you for your help, Mogliii The final code: ################# import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import numpy as np x = np.arange(10) y = np.arange(10) fig_width_cm = 21 # A4 page fig_height_cm = 29.7 inches_per_cm = 1 / 2.54 # Convert cm to inches fig_width = fig_width_cm * inches_per_cm # width in inches fig_height = fig_height_cm * inches_per_cm # height in inches fig_size = [fig_width, fig_height] pdf = PdfPages('outfile.pdf') allplots = 3 # This is the variable number of subplots f, axarr = plt.subplots(allplots, 1) f.set_size_inches(fig_size) for plot in range(allplots): axarr[plot].plot(x + plot, y) pdf.savefig() pdf.close() ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users