![](/img/trans.png)
[英]How do I redraw a matplotlib.pyplot figure in a Jupyter notebook?
[英]Jupyter notebook: How to set matplotlib figure default size persistently, even after `from matplotlib import pyplot`?
我正在尋找一種方法來配置我的默認筆記本設置並設置繪圖和圖形的大小,這樣我就不必為每個筆記本單獨手動設置它。
我知道諸如如何在 ipython notebook 中設置 matplotlib 圖形默認大小之類的問題? 其中詳細說明了如何使用jupyter_notebook_config.py
。
但是,這不起作用,大概是因為我在筆記本中重新導入了 pyplot。 有沒有更好的方法來設置默認設置、行為、選項等?
在 python 3.x 中
ipython profile create
ipython profile locate
轉到定位並編輯 ipython_kernel_config.py 手動添加以下行:
c.InlineBackend.rc = {'figure.dpi':160}
rcParams 引用
https://matplotlib.org/3.1.1/tutorials/introductory/customizing.html
在matplotlib中設置默認繪圖大小的一種方法是:
from pylab import rcParams
rcParams['figure.figsize'] = 8, 6
其中8、6是要設置的圖形尺寸。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.