cottax.consumers.visualization.latex.dot module

Node-link drawings for a LaTeX document: visualization.to_dot with the labels set in LaTeX, written by dot as the PDF the document includes.

A label a LatexFormatter marked (naming.MARKUP) is written as graphviz’s HTML-like label, set by dot with no LaTeX pass. The boundary is collapsed to the XDSM’s two boxes, mathcal{I} and mathcal{O}.

Needs graphviz (the Python package and dot).

render(graph, **kw)[source]

A graphviz.Source, which a notebook shows inline. Arguments are to_dot’s.

save(graph, path, **kw)[source]

The drawing written as the format path’s suffix names. Arguments are to_dot’s.

Return type:

Path

save_panels(panels, *, formats=('pdf',), canvas=None, **kw)[source]

Several drawings as one figure’s panels, at one zoom: each padded (dot’s own pad, evenly, so a smaller graph sits centred) to the largest page. panels is (stem, graph) or (stem, graph, kwargs); canvas=(w, h) in points pins the page.

Return type:

list[Path]

save_row(graphs, path, *, labels=True, sep=24, **kw)[source]

Several drawings as one figure, side by side, labelled (a), (b), … inside it (labels=False drops them, a sequence of strings replaces them). sep is the gap in points; formatter may be one per graph.

Return type:

Path

to_dot(graph, *, formatter: Formatter | None = None, font: str | None = LATIN_MODERN, font_size: int | None = None, edge_font_size: int | None = None, nodesep: float | None = None, ranksep: float | None = None, node_margin: str | None = None, **kw)[source]

visualization.to_dot set in LaTeX, with a figure’s defaults: the boundary collapsed to mathcal{I} / mathcal{O}, no page margin (the cairo back end otherwise puts 36 pt of blank around a PDF), and font for the drawing face. font_size, edge_font_size, nodesep, ranksep and node_margin (“x,y” in inches) retune the type and the spacing; None keeps to_dot’s.

Return type:

str