PyDotPlus
suggest changePyDotPlus is an improved version of the old pydot project that provides a Python Interface to Graphviz’s Dot language.
Installation
For the latest stable version:
pip install pydotplus
For the development version:
pip install https://github.com/carlos-jenkins/pydotplus/archive/master.zip
Load graph as defined by a DOT file
- The file is assumed to be in DOT format. It will be loaded, parsed, and a
Dotclass will be returned, representing the graph. For example, a simpledemo.dot:
digraph demo1{ a -> b -> c; c ->a; }
import pydotplus
graph_a = pydotplus.graph_from_dot_file('demo.dot')
graph_a.write_svg('test.svg') # generate graph in svg.
You will get an SVG (Scalable Vector Graphics) like this. demo.dot is not in this book. write_svg also needs the Graphviz dot program. pydotplus was not installed here, and this was not run.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents