【问题标题】:How to make a cluster style dendrogram in bokeh如何在散景中制作集群风格的树状图
【发布时间】:2014-05-10 08:19:21
【问题描述】:

我想在散景中制作一个集群样式的树状图。 我喜欢这个散景点图示例,但我想让线条弯曲并显示 像这样的集群结构:http://bl.ocks.org/mbostock/4063570

这里是散景示例中的点图代码:

import numpy as np
from bokeh.plotting import *
from bokeh.objects import Range1d

N = 4000

factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
x0 = [0,0,0,0,0,0,0,0]
x =  [50, 40, 65, 10, 25, 37, 80, 60]

output_file("categorical.html", title="categorical.py example")

hold()

segment(x0, factors, x, factors, y_range=factors, x_range=Range1d(start=0, end=100), 
        line_width=2, line_color="green", tools="resize,previewsave", title="Dot Plot")
circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3, Name="categorical example")

figure()

show()  # open a browser

关于如何使线条弯曲并显示树状图中的聚类关系的任何建议。显示此图片只是为了显示带点的直线的概念。实际目标是显示来自单点的所有线的聚类关系。

【问题讨论】:

    标签: python dendrogram bokeh


    【解决方案1】:

    与此同时(四年后,2018-08),我们运行 Bokeh 0.13.0。 由于上面的答案并不令人满意,我想向您指出两个基于散景的树状图实现。

    Daniel Russo 基于量化数据的散景树状图实现: https://russodanielp.github.io/plotting-a-heatmap-with-a-dendrogram-using-bokeh.html

    cdendro,bokehheat 库的基于分类数据的散景树状图实现:https://gitlab.com/biotransistor/bokehheat

    【讨论】:

      【解决方案2】:

      不可能在 Bokeh 中渲染(从 0.4.4 开始),但还没有内置支持来帮助处理图形和图形布局。您必须计算或使用库来计算边缘的线点等,然后将它们传递给 Bokeh。图形支持在我们的路线图上,但可能要到今年晚些时候才会支持,除非我们放弃了完整的 PR。

      【讨论】:

      • 你能给我推荐一些我可以使用的图形库,然后尝试用散景制作它。有什么快速的python图形库吗?如果不是很努力,我会试一试。
      猜你喜欢
      • 1970-01-01
      • 2016-01-14
      • 2012-09-02
      • 1970-01-01
      • 2015-07-05
      • 1970-01-01
      • 2016-12-17
      • 1970-01-01
      • 2016-06-22
      相关资源
      最近更新 更多