Problems with SVG rendering in IPython.display in Jupyter ipynb

Open
#969 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
jupyter-notebook, python
Domain
frontend

Research direction

Start by running SVG_Woe_Demo.ipynb and comparing the three attached SVG files, focusing on the order in which IPython.display.SVG objects are passed to display. Reproduce the scrambled text in subsequent code-cell outputs and trace the notebook output rendering path. Done means the SVGs render consistently and their text is no longer scrambled regardless of display order.

Written by the indexing model from the issue text.

Description

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
figtree_1
figtree_2
SVG_Woe_Demo.ipynb.zip

Dominant language
Python
Stars
734
Forks
411
Avg merge
1d 2h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ipython/ipykernel

All issues in ipython/ipykernel

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.