views:

251

answers:

3

The title kind of says it all really. Matplotlib is fantastic for most graphing applications, but I can't seem to find anything that will make hierarchy or tree diagrams. Does anyone have experience with a package they would wish to recommend?

Thanks in advance for your time,

Dan

+4  A: 

pydot

Ignacio Vazquez-Abrams
Shortest ever answer on SO?
AJ
did that reach the 15 char limit? are there padded spaces? Or is there even a limit?
Anthony Forloney
The anchor tag counts towards the minimum.
Ignacio Vazquez-Abrams
Technically correct - anything based on graphviz is an obvious candidate for this type of application. However, you might want to elaborate on it a bit.
ConcernedOfTunbridgeWells
+1  A: 

While pydot (an interface to the graphviz library) is a great library, unfortunately its layout algorithms won't make the trees look like trees (though there are some hacks to do it, by adding 'invisible' graph nodes).

If you care about that, the O'Reilly book "Programming Collective Intelligence" has code that uses the PIL library to draw trees (such as those that would be the result of a decision tree learning algorithm). Here is a link to the book's source code. The images aren't as pretty as those made by graphviz library, since they are bitmaps and not vectorial, though.

dimatura
Both really useful places to start looking. Thanks very much for your rapid responses.Dan
Dan
A: 

networkx uses both pydot or matplotlib to give a very concise and general network drawing package.

mavnn