草庐IT

clustermap

全部标签

python - seaborn中clustermap的标签

我有几个关于在seaborn中标记clustermap的问题。首先是可以提取层次聚类的距离值,并将值绘制在树结构可视化上(可能只有前三个层次)。这是我创建集群图的示例代码:importpandasaspdimportnumpyasnpimportseabornassnsget_ipython().magic(u'matplotlibinline')m=np.random.rand(50,50)df=pd.DataFrame(m,columns=range(4123,4173),index=range(4123,4173))sns.clustermap(df,metric="correl

python - seaborn中clustermap的标签

我有几个关于在seaborn中标记clustermap的问题。首先是可以提取层次聚类的距离值,并将值绘制在树结构可视化上(可能只有前三个层次)。这是我创建集群图的示例代码:importpandasaspdimportnumpyasnpimportseabornassnsget_ipython().magic(u'matplotlibinline')m=np.random.rand(50,50)df=pd.DataFrame(m,columns=range(4123,4173),index=range(4123,4173))sns.clustermap(df,metric="correl

python - 从 seaborn clustermap 中提取集群

我正在使用seabornclustermap创建集群,它在视觉上效果很好(这个example产生非常相似的结果)。但是,我无法弄清楚如何以编程方式提取集群。例如,在示例链接中,我怎样才能发现1-1rh、1-1lh、5-1rh、5-1lh是一个好的集群?视觉上很容易。我正在尝试使用查看数据和树状图的方法,但收效甚微编辑示例代码:importpandasaspdimportseabornassnssns.set(font="monospace")df=sns.load_dataset("brain_networks",header=[0,1,2],index_col=0)used_netw

python - 如何给 sns.clustermap 一个预先计算的距离矩阵?

通常当我做树状图和热图时,我使用距离矩阵并做一堆SciPy的东西。我想尝试Seaborn但Seaborn想要我的数据为矩形(rows=samples、cols=attributes,而不是距离矩阵)?我基本上想使用seaborn作为后端来计算我的树状图并将其添加到我的热图上。这可能吗?如果没有,这是否可以成为future的功能。也许我可以调整一些参数,以便它可以采用距离矩阵而不是矩形矩阵?用法如下:seaborn.clustermap¶seaborn.clustermap(data,pivot_kws=None,method='average',metric='euclidean',z