jupyter 笔记本内联图作为 svg [英] jupyter notebook inline plots as svg

查看:51
本文介绍了jupyter 笔记本内联图作为 svg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,jupyter notebook 内嵌图显示为 png,例如:

By default jupyter notebook inline plots are displayed as png, e.g.:

import matplotlib.pyplot as plt
%matplotlib inline
plt.plot()

如何配置 jupyter notebooks 以将 matplotlib 内联图显示为 svg?

How can you configure jupyter notebooks to display matplotlib inline plots as svg?

推荐答案

使用 set_matplotlib_formats('svg').

import matplotlib.pyplot as plt
from IPython.display import set_matplotlib_formats
%matplotlib inline
set_matplotlib_formats('svg')
plt.plot()

这也记录在%matplotlib 魔法的文档.

注意:InlineBackend.figure_format已弃用.

这篇关于jupyter 笔记本内联图作为 svg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆