如何让 matplotlibs nbagg 后端生成 SVG?
How to make matplotlibs nbagg backend generate SVGs?
目前,我在笔记本的开头使用以下内容生成 SVG 图:
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
当使用 nbagg
后端时(例如:%matplotlib nbagg
),绘图生成为 PNG。是否可以配置 nbagg
后端来生成 SVG?
Agg backend in matplotlib uses the Anti-Grain Geometry二维图形库生成位图图形。后端说明的文档:
Output to RGBA and PNG, optionally JPEG and TIFF
NbAgg backend wraps the Agg backend (via WebAgg core)等也仅限于那些输出类型。
请注意,这只是定义了用于生成图形以供 查看 的后端。无论后端如何,您仍然可以使用 figure.savefig('<filename'> format='svg')
(或使用以 .svg
结尾的文件名)将图形保存为 SVG 格式。
目前,我在笔记本的开头使用以下内容生成 SVG 图:
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
当使用 nbagg
后端时(例如:%matplotlib nbagg
),绘图生成为 PNG。是否可以配置 nbagg
后端来生成 SVG?
Agg backend in matplotlib uses the Anti-Grain Geometry二维图形库生成位图图形。后端说明的文档:
Output to RGBA and PNG, optionally JPEG and TIFF
NbAgg backend wraps the Agg backend (via WebAgg core)等也仅限于那些输出类型。
请注意,这只是定义了用于生成图形以供 查看 的后端。无论后端如何,您仍然可以使用 figure.savefig('<filename'> format='svg')
(或使用以 .svg
结尾的文件名)将图形保存为 SVG 格式。