Re: very long dendrogram

*To*: mathgroup at smc.vnet.net*Subject*: [mg91459] Re: [mg91422] very long dendrogram*From*: Darren Glosemeyer <darreng at wolfram.com>*Date*: Fri, 22 Aug 2008 03:13:53 -0400 (EDT)*References*: <200808210815.EAA07234@smc.vnet.net>

Paul Slater wrote: > I have produced a hierarchical clustering > of 3,107 U. S. counties based on 1995-2000 > migration flows between the counties using a certain non-standard > methodology > (http://arxiv.org/abs/0807.1550). I have been able to > convert the results into a cluster object for use by > the `Hierarchical Clustering" package of Mathematica. > > However, if I try to produce the full (very long) > dendrogram or even use the command, say, > TruncateDendrogram->{1,25}], , using say > Orientation->Right, the result is > not readable, being "crammed" into a small space. > So, I would like to expand this space by several orders. > > If this problem can be overcome, I would also > like to be able to eventually label the leaves of the dendrogram > by the names of the counties. But > "For Cluster objects, the LeafLabels option > can take a function but not a list or Automatic, > as there is no unambiguous mapping between > the labels and data points in a Cluster object." > So, I am not sure how to proceed in this regard. > > Paul B. Slater > Graphics options like AspectRatio and ImageSize are allowed to pass through DendrogramPlot, so you could play with these options to make a readable graphic. For instance, << HierarchicalClustering` data = BlockRandom[SeedRandom[1]; RandomInteger[10^6, 3107]]; DendrogramPlot[data, TruncateDendrogram -> {1, 25}, Orientation -> Right, AspectRatio -> 2, LeafLabels -> (# &)] is readable for me. To add names to the clustering, consider the {e1,e2,...}->{v1,v2,...} data syntax for FindClusters and Agglomerate. If you are performing the clustering via Agglomerate, you can simply use this syntax. As an example, compare the following two clusterings and plots. cl1 = Agglomerate[2^Range[3]] DendrogramPlot[cl1, LeafLabels -> Automatic] cl2 = Agglomerate[2^Range[3] -> {"name1", "name2", "name3"}] DendrogramPlot[cl2, LeafLabels -> Automatic] However, it sounds like you may have constructed your own Cluster object from information in the paper referenced. If this is the case, you can compare the results for cl1 and cl2 above to see where you would need to place the country names in your object and then use LeafLabels->Automatic in DendrogramPlot. Darren Glosemeyer Wolfram Research

**References**:**very long dendrogram***From:*Paul Slater <slater@kitp.ucsb.edu>