victormocioiu / scipy-cluster

Automatically exported from code.google.com/p/scipy-cluster
Other
0 stars 0 forks source link

Custom labels not working #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
R = dendrogram(Z, labels = ['test' for i in range(0,150)])

/usr/lib64/python2.4/site-packages/hcluster/cluster.pyc in
_append_singleton_leaf_node(Z, p, n, level, lvs, ivl, leaf_label_func, i,
labels)
   2532             # for the leaf nodes, use it.
   2533             if labels is not None:
-> 2534                 ivl.append(labels[i-n])
   2535             else:
   2536                 # Otherwise, use the id as the label for the leaf.x

TypeError: list indices must be integers

Solution:
Change row 2534 to:
ivl.append(labels[int(i-n)])

Original issue reported on code.google.com by mdeholla...@gmail.com on 18 Feb 2008 at 1:46

GoogleCodeExporter commented 8 years ago
Whoops. This is a MATLAB compatibility problem. The first and second columns of 
the
linkage matrix are the indices of the joined clusters and the third column is 
their
distance, which is a double. Since it's harder to work with matrices that have
different types for different columns, the entire matrix is double. Casting to 
an
int, as you suggest, is the correct thing to do.

You should see a release later this evening.

Thanks!

Damian Eads

Original comment by damian.e...@gmail.com on 25 Feb 2008 at 2:20