DiagramRender

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

DiagramRender

class DiagramRender

A rendered diagram or tensor network snapshot with its notebook display. Displaying or exporting the snapshot reuses the rendered SVG and labels.

Examples

from symbolica.community.tensor import TensorNetwork, RenderSettings
from symbolica import E
drawing = TensorNetwork(E("1")).render(config=RenderSettings(node_radius=5))
drawing
svg = drawing.to_svg()

Methods

Name Description
__repr__ Summarize the rendered snapshot in text-only frontends.
_mime_ Display the configured HTML figure in Marimo.
_repr_html_ Display the configured figure in IPython and Jupyter.
_repr_svg_ Provide the configured SVG to SVG-aware notebook frontends.
to_html Export the notebook HTML figure with its caption and interactive SVG.
to_linnest Export a self-contained Typst document embedding this rendered SVG.
to_svg Export the configured SVG, including typeset labels and hover information.

__repr__

DiagramRender.__repr__() -> builtins.str

Summarize the rendered snapshot in text-only frontends.

Examples

Using the setup in the DiagramRender class example:

repr(drawing)
'DiagramRender()'

_mime_

DiagramRender._mime_() -> tuple[builtins.str, builtins.str]

Display the configured HTML figure in Marimo.

Examples

Using the setup in the DiagramRender class example:

import marimo as mo
mo.as_html(drawing)

_repr_html_

DiagramRender._repr_html_() -> builtins.str

Display the configured figure in IPython and Jupyter.

Examples

Using the setup in the DiagramRender class example:

from IPython.display import display
display(drawing)

_repr_svg_

DiagramRender._repr_svg_() -> builtins.str

Provide the configured SVG to SVG-aware notebook frontends.

Examples

Using the setup in the DiagramRender class example:

svg = drawing._repr_svg_()

to_html

DiagramRender.to_html() -> builtins.str

Export the notebook HTML figure with its caption and interactive SVG.

Examples

Using the setup in the DiagramRender class example:

html = drawing.to_html()

to_linnest

DiagramRender.to_linnest() -> builtins.str

Export a self-contained Typst document embedding this rendered SVG.

Examples

Using the setup in the DiagramRender class example:

from pathlib import Path
Path("diagram.typ").write_text(drawing.to_linnest())

to_svg

DiagramRender.to_svg() -> builtins.str

Export the configured SVG, including typeset labels and hover information.

Examples

Using the setup in the DiagramRender class example:

from pathlib import Path
Path("diagram.svg").write_text(drawing.to_svg())