source: orange/Orange/testing/regression/tests_20/modules_hclust-colored-dendrogram.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 705 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.