There is also this workaround in case you want to change the size without using the figure environment. So in case you are using
plt.plot() for example, you can set a tuple with width and height.
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20,3)
This is very useful when you plot inline (e.g., with IPython Notebook). As asmaier noticed, it is preferable to not put this statement in the same cell of the imports statements.
To reset the global figure size back to default for subsequent plots:
plt.rcParams["figure.figsize"] = plt.rcParamsDefault["figure.figsize"]
Conversion to cm
figsize tuple accepts inches, so if you want to set it in centimetres you have to divide them by 2.54. Have a look at this question.