API reference

andrey.viz.SVG#

class andrey.viz.SVG[source]#

An SVG document that renders itself in notebooks and doc pages.

A plain str subclass, so it slices, concatenates, and writes to a file exactly like the markup it holds. The only addition is _repr_html_, which Jupyter calls to display the graph inline instead of printing several kilobytes of markup.

Examples

>>> from andrey.viz import SVG
>>> svg = SVG("<svg></svg>")
>>> isinstance(svg, str) and svg._repr_html_() == svg
True