From 1c0743a6e6cd6033a29041fdd3770a4e39fca8ec Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Mon, 30 Sep 2019 00:20:40 +0300 Subject: [PATCH] doc(#13): sample code to plot workflow diagram in intro --- README.md | 13 +++++++++++++ docs/source/index.rst | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 0e1e95a4..e06f257e 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,19 @@ print(out) As you can see, any function can be used as an operation in GraphKit, even ones imported from system modules! +As a debug aid, you may plot the workflow with one of these methods: + +```python + graph.net.plot(show=True) # open a matplotlib window + graph.net.plot("path/to/workflow.png") # supported files: .png .dot .jpg .jpeg .pdf .svg +``` + +> `graphviz` must be in your PATH, and `pydot` & `matplotlib` python packages installed. +> You may install both when installing *graphkit* with its `plot` extras: +> ```python +> pip install graphkit[plot] +> ``` + # License Code licensed under the Apache License, Version 2.0 license. See LICENSE file for terms. diff --git a/docs/source/index.rst b/docs/source/index.rst index 5c5e505c..4b2e049a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -69,6 +69,18 @@ Here's a Python script with an example GraphKit computation graph that produces As you can see, any function can be used as an operation in GraphKit, even ones imported from system modules! +As a debug aid, you may plot the workflow with one of these methods:: + + graph.net.plot(show=True) # open a matplotlib window + graph.net.plot("path/to/workflow.png") # supported files: .png .dot .jpg .jpeg .pdf .svg + +.. NOTE:: + `graphviz` must be in your PATH, and `pydot` & `matplotlib` python packages installed. + You may install both when installing *graphkit* with its `plot` extras:: + + pip install graphkit[plot] + + License -------