Display/animate SVG files

I’d like to display multiple SVG files, but overwriting previous, a la “ion” from matplotlib. Is this possible? e.g.:
from IPython.display import SVG, display
def show_svg(frame_idx):
fname = ‘file:///path-to/file%d.svg’ % frame_idx
display(SVG(url=fname))

for idx in range(10):
show_svg(idx)

IPython has a clear_output function.

2 Likes

Via @story645 / Hannah on Twitter, I spotted this simple editor for creating simple SVG diagrams within a notebook: https://github.com/uclmr/egal .

It also claims to support the creation and replay of animated SVGs, but I couldn’t obviously find a way to enable the animation feature myself.

2 Likes