bdendro.dendrogram_renderer function

bdendro.dendrogram_renderer(Z, threshold=None, vertical=True)[source]

Make a renderer of a dendrogram.

Parameters
  • Z ((N - 1, 4) numpy.ndarray) – Linkage matrix returned by scipy.cluster.hierarchy.linkage function. N is the number of leaves.

  • threshold (float or None, optional) – Height for cutting a dendrogram in subtrees. If None, a dendrogram is not cut.

  • vertical (bool, optional) – If True, the height direction of a dendrogram is the y direction. If False, it is the x direction.

Returns

graph (bokeh.models.renderers.GraphRenderer) – Renderer of a dendrogram

Notes

Information about subtrees is contained in graph.node_renderer.data_source.data['subtree'] and graph.edge_renderer.data_source.data['subtree']. They are lists of labels of subtrees to which nodes/edges belong. The label of the ith subtree is str(i). If a node/edge does not belong to any subtrees, the corresponding item is an empty string.