在python中手动绘制树状图 [英] Draw dendrogram in python manually

查看:714
本文介绍了在python中手动绘制树状图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一种算法来解决图形中的聚类问题.我使用python库"python-graph"来表示图.现在,在计算的每个步骤(算法是迭代的)中,我都必须绘制部分树状图.实际上,从原始图形开始计算聚类的意义上说,该算法是分裂性的.现在,我不知道该用什么来绘制树状图(有人建议使用PIL,但我正在寻找简单的方法,而且我不知道如何使用PIL)...用它做图吗?

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.

谢谢!

推荐答案

实现实现将为您提供帮助继续前进.

Code to implement scipy dendrogram can be found here and this simple implementation will help you to move on.

这篇关于在python中手动绘制树状图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆