mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
557 stars 142 forks source link

render svg inlined in IPython notebook #46

Closed jf--- closed 6 years ago

jf--- commented 6 years ago

Its really handy being able to render a Path inlined in IPython notebook PR following shortly...

mathandy commented 6 years ago

That'd be great -- it's been a while so I'm closing this issue. Feel free to make a pull request or add any info if you like.

v-a-s-a commented 5 years ago

It's a hack, but I've been using the following:

import svgpathtools as spt
import tempfile, os
from IPython.display import SVG, display

paths, attributes = spt.svg2paths('test.svg')
with tempfile.TemporaryDirectory() as tmp_dir:
    tmp_svg = os.path.join(tmp_dir, 'display.svg')
    spt.wsvg(paths, filename = tmp_svg)
    display(SVG(tmp_svg))