| 1 |
Export to DOT |
| 2 |
============= |
| 3 |
|
| 4 |
Any :any:`anytree` graph can be converted to a graphviz_ graph. |
| 5 |
|
| 6 |
This tree:: |
| 7 |
|
| 8 |
>>> from anytree import Node |
| 9 |
>>> root = Node("root") |
| 10 |
>>> s0 = Node("sub0", parent=root) |
| 11 |
>>> s0b = Node("sub0B", parent=s0) |
| 12 |
>>> s0a = Node("sub0A", parent=s0) |
| 13 |
>>> s1 = Node("sub1", parent=root) |
| 14 |
>>> s1a = Node("sub1A", parent=s1) |
| 15 |
>>> s1b = Node("sub1B", parent=s1) |
| 16 |
>>> s1c = Node("sub1C", parent=s1) |
| 17 |
>>> s1ca = Node("sub1Ca", parent=s1c) |
| 18 |
|
| 19 |
Can be rendered to a tree by :any:`RenderTreeGraph`:: |
| 20 |
|
| 21 |
>>> from anytree.dotexport import RenderTreeGraph |
| 22 |
>>> RenderTreeGraph(root).to_picture("tree.png") # doctest: +SKIP |
| 23 |
|
| 24 |
.. image:: static/tree.png |
| 25 |
|
| 26 |
.. automodule:: anytree.dotexport |
| 27 |
:inherited-members: |
| 28 |
|
| 29 |
.. _graphviz: http://www.graphviz.org/ |