问题
I have implemented an algorithm to solve the problem of clustering in a graph. I used the python library "python-graph" to represent the graph. Now, at each step of my computation (the algorithm is iterative) I have to draw a part of the dendrogram. In fact, the algorithm is divisive, in the sense that starting from the original graph calculates the clusters. Now, I don't know what to use to draw the dendrogram (someone suggested PIL, but I'm looking for something easy and I don't know how to use PIL)... can you suggest something and show me how to do plot with it?
Note: I read other questions but everything seems to use methods that use automatic computation of the clusters... this is not what I'm looking for: I need to manually draw the dendrogram or at least find a way to represent the clusters computed to be drawn.
Thanks!
回答1:
Code to implement scipy dendrogram can be found here and this simple implementation will help you to move on.
回答2:
perhaps an other solution could be this one: http://ete.cgenomics.org/ I recommend you the main help pdf to start: http://ete.cgenomics.org/releases/ete2/doc/ete_tutorial.pdf
回答3:
The ETE python toolkit gives you a lot of possibilities for tree drawing. The drawing engine allows for programmatic tree rendering. Trees can be plotted as PNG or SVG images. Dendrograms can be represented as rectangular or circular tress.
Although ETE is commonly used to deal with phylogenetic trees, it provides also a clustering module, with several special predefined visualization modes.
Check some examples at http://packages.python.org/ete2/tutorial/tutorial_drawing.html
来源:https://stackoverflow.com/questions/6484399/draw-dendrogram-in-python-manually