["python","python-2.7","python-3.x","matplotlib"]
Change figure size and figure format in matplotlib

I want to obtain fig1 exactly of 4 by 3 inch sized, and in tiff format correcting the program below: import matplotlib.pyplot as plt list1 = [3,4,5,6,9,12] list2 = [8,12,14,15,17,20] plt.plot(list1, list2) plt.savefig('fig1.png', dpi = 300) plt.close()
You can set the figure size if you explicitly create the figure with plt.figure(figsize=(3,4)) You need to set figure size before calling plt.plot() To change the format of the saved figure just change the extension in the file name. However, I don't know if any of matplotlib backends support tiff