Drawing ======== NetworkX provides interfaces to two packages for graph drawing, matplotlib and graphviz. Matplotlib ---------- To use the NetworkX matplotlib interface you need: - Matplotlib version 0.73.1 or later http://matplotlib.sourceforge.net/ Follow the instructions at http://matplotlib.sourceforge.net/installing.html to install the software. Graphviz -------- NetworkX provides an interface to graphviz to write graphs in the dot language. The resulting "dot" files can be processed using the graphviz tool kit to make graph drawings in many different styles and output formats. To use the graphviz interface you need: - Graphviz, version 2.0 or later http://graphviz.org/ and one of either pygraphviz or pydot (with this patch_) Pygraphviz ~~~~~~~~~~ Pygraphviz is a Python wrapper to the graphviz Agraph data structure. The C code in the graphviz library is wrapped using SWIG. - Pygraphviz, version 0.21 or later http://networkx.lanl.gov/pygraphviz/ Pydot ~~~~~ Pydot is a pure Python interface to graphviz. - Pydot, version 0.9.10 or later http://www.dkbza.org/pydot.html - Pyparsing, version 1.3 or later http://pyparsing.sourceforge.net/ Pydot has a known bug in parsing double quoted strings and in representing the special graphviz null symbol '\\N'. In order for it to work properly with NetworkX you must apply this patch_ (or make the changes yourself in dot_parser.py). .. _patch: pydot-quote.patch Using ----- >>> import networkx as NX >>> G=NX.tetrahedral_graph() Draw with matplotlib: >>> import pylab as P >>> NX.draw(G) >>> P.savefig("tetrahedral.png") >>> P.show() .. raw:: html