从Bokeh以svg或pdf格式导出数字? [英] Exporting figures from Bokeh as svg or pdf?
问题描述
是否可以将Bokeh中的单个图形输出为pdf或svg图像?我觉得自己似乎遗漏了一些明显的东西,但是我检查了联机帮助页面并通过了bokeh.objects
api,但是没有发现任何东西...
Is it possible to output individual figures from Bokeh as pdf or svg images? I feel like I'm missing something obvious, but I've checked the online help pages and gone through the bokeh.objects
api and haven't found anything...
推荐答案
当前无法保存PDF,但是从Bokeh 0.12.6
开始,现在可以直接从中导出PNG和SVG.
Python代码.
There is no way to save PDF currently, but as of Bokeh 0.12.6
, it is now possible to export PNG and SVG directly from
Python code.
导出PNG看起来像这样
Exporting PNGs looks like this
export_png(plot, filename="plot.png")
导出SVG看起来像这样
And exporting SVGs looks like this
plot.output_backend = "svg"
export_svgs(plot, filename="plot.svg")
需要安装一些可选的依赖项. 您可以在《用户指南》的导出图表部分.
There are some optional dependencies that need to be installed. You can find more information in the Exporting Plots section of the User Guide.
这篇关于从Bokeh以svg或pdf格式导出数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!