Pydot graphs in matplotlib?

I'm curious if anyone knows a good way to embed pydot
(http://code.google.com/p/pydot/) graphs (or really, any
graphviz-style graphs) inside matplotlib somehow. I could easily
write out a png or something from pydot and then imshow it, but that
seems very kludgy. Is there some way to load svg or other vector data
into matplotlib to be shown inside a figure?

Erik Tollerud wrote:

I'm curious if anyone knows a good way to embed pydot
(http://code.google.com/p/pydot/) graphs (or really, any
graphviz-style graphs) inside matplotlib somehow. I could easily
write out a png or something from pydot and then imshow it, but that
seems very kludgy. Is there some way to load svg or other vector data
into matplotlib to be shown inside a figure?

Unfortunately not. It is possible to cut-and-paste graphviz SVG into a matplotlib SVG using Inkscape, but that's fairly kludgy also and can't be automated.

It would be nice to have a graphviz importer for matplotlib (something that would convert a dot stream to matplotlib artists), but that's a mid-sized development effort... It wouldn't consider it extremely difficult, but it would need someone to step up to implement it.

Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Erik Tollerud-2 wrote:

I'm curious if anyone knows a good way to embed pydot
(http://code.google.com/p/pydot/) graphs (or really, any
graphviz-style graphs) inside matplotlib somehow.

The closest thing is probably NetworkX (http://networkx.lanl.gov/index.html)
and PyGraphviz (http://networkx.lanl.gov/pygraphviz/)

The above tools can at least provide the position of the nodes, but I don't
think they use the drawing information provided by Graphviz.

As mentioned in another post, it is not that hard to write a Graphviz to
Matplotlib converter. Graphviz can output very detailed rendering
information when using the xdot output format
(http://www.graphviz.org/doc/info/output.html#d:xdot) Sounds like a fun
weekend project :slight_smile:

- Kjell Magne Fauske

···


View this message in context: http://old.nabble.com/Pydot-graphs-in-matplotlib--tp27602474p27701290.html
Sent from the matplotlib - users mailing list archive at Nabble.com.