ipython / ipython/ipykernel

Problems with SVG rendering in IPython.display in Jupyter ipynb

未关闭
#969 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
734
派生
412
平均合并
1 天 5 小时
30 天内合并 PR
8

描述

I'm trying to use IPython to display SVGs in the output of code cells, but I've observed some very strange behaviour in the way it renders: text in the images displays correctly in the first SVG I display, but in all the subsequent SVGs displayed, it is scrambled.

Displayed in markdown cells using html, all the SVGs display perfectly, but rendered in the code output by IPython they are scrambled. If I create a new `IPython.display.SVG` object from the file that was the first to display, it also displays correctly. It seems that the factor that determines which image will be displayed correctly is the order in which the `IPython.display.SVG` object is passed to `display`, not the order in which the filenames for the svg-files are passed to `SVG`. I've included the three svg-files, and an ipynb that demonstrates all of this.

This is very confusing - can you help?

![figtree_0](https://user-images.githubusercontent.com/13968936/179910946-2f7c000a-07d1-4026-9647-82ff7ea69e30.svg)
![figtree_1](https://user-images.githubusercontent.com/13968936/179910951-0fd452bf-63d6-4625-a237-d4690f8755dc.svg)
![figtree_2](https://user-images.githubusercontent.com/13968936/179910953-41f09cfe-5a90-42c7-b84d-dc55a00aca47.svg)
[SVG_Woe_Demo.ipynb.zip](https://github.com/ipython/ipykernel/files/9147007/SVG_Woe_Demo.ipynb.zip)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。