Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock.utils.plot.DotGraph Class Reference

Public Member Functions

 __init__ (self, dot_source)
 __repr__ (self)

Public Attributes

 dot_source = dot_source

Protected Member Functions

 _repr_html_ (self)

Detailed Description

Wrap a Graphviz DOT graph source so it renders as inline SVG.

Meant to display the solver graphs produced by e.g.
``model.get_solver_dot_graph()`` or ``setup_node.get_dot()`` in the
sphinx-gallery generated examples: sphinx-gallery captures the
``_repr_html_`` of an expression left bare as the last statement of a
code block (the same mechanism Jupyter uses for rich display), so no
custom scraper is needed. See https://stackoverflow.com/a/65117672 for
the technique this is based on.

``_repr_html_`` is only defined if the graphviz python package (and the
Graphviz ``dot`` executable) are installed; otherwise this falls back to
``__repr__``, i.e. the raw DOT source.

Parameters
----------
dot_source : str
    Source of the graph in the DOT language.

Definition at line 120 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

shamrock.utils.plot.DotGraph.__init__ ( self,
dot_source )

Definition at line 142 of file __init__.py.

Member Function Documentation

◆ __repr__()

shamrock.utils.plot.DotGraph.__repr__ ( self)

Definition at line 151 of file __init__.py.

◆ _repr_html_()

shamrock.utils.plot.DotGraph._repr_html_ ( self)
protected

Definition at line 145 of file __init__.py.

Member Data Documentation

◆ dot_source

shamrock.utils.plot.DotGraph.dot_source = dot_source

Definition at line 143 of file __init__.py.


The documentation for this class was generated from the following file: