Include output from %matplotlib notebook backend as SVG in ipynb

前端 未结 2 982
鱼传尺愫
鱼传尺愫 2021-02-19 21:47

This answer from a few years ago shows how you can make jupyter notebook create graphs as svg. The solution is to tell the InlineBackend to use svg as output.

2条回答
  •  渐次进展
    2021-02-19 22:46

    Since apparently even after a bounty period noone was able to provide a solution, a workaround may be the following.

    1. Create you notebook with %matplotlib notebook. Once you're satisfied with the result, save it.
    2. Use a copy of it and replace %matplotlib notebook with

      %matplotlib inline
      %config InlineBackend.figure_format = 'svg'
      

      Rerun the complete notebook. Save the result.

    3. Open the resulting ipynb file in a text editor and replace the previous two lines again with %matplotlib notebook.

    The final result will be a ipynb with svg images. But once opened and run, it will use the notebook backend for figure creation.

提交回复
热议问题