Fab*_*ost 21 svg matplotlib jupyter-notebook
默认情况下,jupyter笔记本内联图显示为png,例如:
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot()
Run Code Online (Sandbox Code Playgroud)
你如何配置jupyter笔记本显示matplotlib内嵌图作为svg?
Fab*_*ost 44
%config InlineBackend.figure_formats = ['svg']
诀窍.一个最小的例子是:
%config InlineBackend.figure_formats = ['svg']
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot()
Run Code Online (Sandbox Code Playgroud)
nek*_*uuu 12
使用set_matplotlib_formats('svg')
.
import matplotlib.pyplot as plt
from IPython.display import set_matplotlib_formats
%matplotlib inline
set_matplotlib_formats('svg')
plt.plot()
Run Code Online (Sandbox Code Playgroud)
这也记录在%matplotlib magic的文档中.
注意:InlineBackend.figure_format
已弃用.
Shr*_*gde 12
set_matplotlib_formats()
自 2021 年 5 月起已弃用。
DeprecationWarning:
set_matplotlib_formats
自 IPython 7.23 起已弃用,直接使用matplotlib_inline.backend_inline.set_matplotlib_formats()
set_matplotlib_formats('svg')
目前的工作方式:
%matplotlib inline
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('svg')
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10444 次 |
最近记录: |