Exporting figures from Bokeh as svg or pdf?

前端 未结 3 1038
再見小時候
再見小時候 2021-01-01 11:13

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 thr

3条回答
  •  庸人自扰
    2021-01-01 11:41

    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.

    Exporting PNGs looks like this

    export_png(plot, filename="plot.png")
    

    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.

提交回复
热议问题