我想学习如何使用jupyter笔记本中的内联后端配置matplotlib的默认值.具体来说,我想将默认的'figure.figsize'设置为[7.5,5.0]而不是默认的[6.0,4.0].我正在使用matplotlib 1.4.3在Mac上使用jupyter notebook 1.1.
在笔记本中,使用macosx后端,我的matplotlibrc文件显示在标准位置,figsize按照matplotlibrc中的指定设置:
In [1]: %matplotlib
Using matplotlib backend: MacOSX
In [2]: mpl.matplotlib_fname()
Out[2]: u'/Users/scott/.matplotlib/matplotlibrc'
In [3]: matplotlib.rcParams['figure.figsize']
Out[3]:[7.5, 5.0]
Run Code Online (Sandbox Code Playgroud)
但是,当我使用内联后端时,figsize设置不同:
In [1]: %matplotlib inline
In [2]: mpl.matplotlib_fname()
Out[2]: u'/Users/scott/.matplotlib/matplotlibrc'
In [3]: matplotlib.rcParams['figure.figsize']
Out[3]:[6.0, 4.0]
Run Code Online (Sandbox Code Playgroud)
在我的笔记本配置文件〜/ .jupyter/jupyter_notebook_config.py中,我还添加了该行
c.InlineBackend.rc = {'figure.figsize': (7.5, 5.0) }
Run Code Online (Sandbox Code Playgroud)
但这也没有效果.现在我被困在每个笔记本中添加这一行:
matplotlib.rcParams['figure.figsize']=[7.5, 5.0]
Run Code Online (Sandbox Code Playgroud)
有没有办法设置内联后端的默认值?