一些rcParameters是專門爲inline
後端設置的。這些是
{'figure.figsize': (6.0,4.0),
'figure.facecolor': (1,1,1,0), # play nicely with white background in the Qt and notebook
'figure.edgecolor': (1,1,1,0),
'font.size': 10, # 12pt labels get cutoff on 6x4 logplots, so use 10pt.
'figure.dpi': 72, # 72 dpi matches SVG/qtconsole
'figure.subplot.bottom' : .125 # 10pt still needs a little more room on the xlabel
}
而他們居住的地方是ipykernel/pylab/config.py
文件。 可以編輯該文件以獲得所需的行爲,例如,通過將facecolor更改爲'figure.facecolor': (1,1,1,1)
(不透明)。
另一種選擇是:
的rcParameters被定義爲InlineBackend
類的一部分,特別是InlineBackend.rc
屬性其爲traitlets.Dict
對象。
這些可以使用ipython configuration system如下更改。
從命令行輸入ipython profile create
這將在~/.ipython
中生成默認配置文件。在主配置文件~/.ipython/ipython_config.py
包括行:
c.InlineBackend.rc.update({"figure.facecolor": "white"})
所以現在的問題是如何避免在您的筆記本電腦每一次的頂部輸入'plt.rcParams [「figure.facecolor」] =「白色」'。那是對的嗎? – ImportanceOfBeingErnest
是的,這是正確的 –