[matplotlib] How to set the matplotlib figure default size in ipython notebook?

I use "$ipython notebook --pylab inline" to start the ipython notebook. The display matplotlib figure size is too big for me, and I have to adjust it manually. How to set the default size for the figure displayed in cell?

This question is related to matplotlib ipython-notebook

The answer is


Worked liked a charm for me:

matplotlib.rcParams['figure.figsize'] = (20, 10)

Just for completeness, this also works

from IPython.core.pylabtools import figsize
figsize(14, 7)

It is a wrapper aroung the rcParams solution


If you don't have this ipython_notebook_config.py file, you can create one by following the readme and typing

ipython profile create

plt.rcParams['figure.figsize'] = (15, 5)

In iPython 3.0.0, the inline backend needs to be configured in ipython_kernel_config.py. You need to manually add the c.InlineBackend.rc... line (as mentioned in Greg's answer). This will affect both the inline backend in the Qt console and the notebook.