Skip to content

Commit 9df4f3f

Browse files
authored
Merge pull request #130 from kayjan/add-docs-export
Added: Examples in docstring on displaying pydot with IPython
2 parents 6984577 + 49a39a2 commit 9df4f3f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

bigtree/dag/export.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ def dag_to_dot(
201201
>>> e = DAGNode("e", step=3, parents=[d])
202202
>>> dag_graph = dag_to_dot(a)
203203
204+
Display image directly without saving (requires IPython)
205+
206+
>>> from IPython.display import Image, display
207+
>>> plt = Image(dag_graph.create_png())
208+
>>> display(plt)
209+
204210
Export to image, dot file, etc.
205211
206212
>>> dag_graph.write_png("tree_dag.png")

bigtree/tree/export.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,12 @@ def tree_to_dot(
640640
>>> e = Node("e", age=35, parent=b)
641641
>>> graph = tree_to_dot(root)
642642
643+
Display image directly without saving (requires IPython)
644+
645+
>>> from IPython.display import Image, display
646+
>>> plt = Image(graph.create_png())
647+
>>> display(plt)
648+
643649
Export to image, dot file, etc.
644650
645651
>>> graph.write_png("tree.png")

0 commit comments

Comments
 (0)