source: orange/Orange/doc/modules/hclust-colored-dendrogram.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 705 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1import orange
2import orngClustering
3
4data = orange.ExampleTable("iris")
5sample = data.selectref(orange.MakeRandomIndices2(data, 20), 0)
6root = orngClustering.hierarchicalClustering(sample)
7reduced = orange.ExampleTable(orange.Domain(sample.domain[:2], False), sample)
8
9my_colors = [(255,0,0), (0,255,0), (0,0,255)]
10cls = orngClustering.hierarchicalClustering_topClusters(root, 3)
11colors = dict([(cl, col) for cl, col in zip(cls, my_colors)])
12print data.native(2)
13orngClustering.dendrogram_draw("hclust-colored-dendrogram.png", root, data = reduced, labels=[str(d.getclass()) for d in sample],
14    cluster_colors=colors, color_palette=[(0, 255, 0), (0, 0, 0), (255, 0, 0)], gamma=0.5, minv=2.0, maxv=7.0)
15
Note: See TracBrowser for help on using the repository browser.