dendrogram
              Plot a dendrogram of a hierarchical binary cluster tree.
 Given tree, a hierarchical binary cluster tree as the output of
 linkage, plot a dendrogram of the tree. The number of leaves shown by
 the dendrogram plot is limited to p. The default value for p is
 30. Set p to 0 to plot all leaves.
The optional outputs are h, t and perm:
Additional input properties can be specified by pairs of properties and values. Known properties are:
"Reorder"
 Reorder the leaves of the dendrogram plot using a numerical vector of size n,
 the number of leaves. When p is smaller than n, the reordering
 cannot break the p groups of leaves.
 "Orientation"
 Change the orientation of the plot. Available values: top (default),
 bottom, left, right.
 "CheckCrossing"
 Check if the lines of a reordered dendrogram cross each other. Available
 values: true (default), false.
 "ColorThreshold"
 Not implemented.
 "Labels"
 Use a char, string or cellstr array of size n to set the label for each
 leaf; the label is dispayed only for nodes with just one leaf.
 See also: cluster, clusterdata, cophenet, inconsistent, linkage, pdist
Source Code: dendrogram
| 
 ## simple dendrogram
 y = [4, 5; 2, 6; 3, 7; 8, 9; 1, 10];
 y(:,3) = 1:5;
 dendrogram (y);
 title ("simple dendrogram");
                     | 
 
                  | 
 ## another simple dendrogram
 v = 2 * rand (30, 1) - 1;
 d = abs (bsxfun (@minus, v(:, 1), v(:, 1)'));
 y = linkage (squareform (d, "tovector"));
 dendrogram (y);
 title ("another simple dendrogram");
                     | 
 
                  | 
 ## collapsed tree, find all the leaves of node 5
 X = randn (60, 2);
 D = pdist (X);
 y = linkage (D, "average");
 subplot (2, 1, 1);
 title ("original tree");
 dendrogram (y, 0);
 subplot (2, 1, 2);
 title ("collapsed tree");
 [~, t] = dendrogram (y, 20);
 find(t == 5)
ans = 5
                     | 
 
                  | 
 ## optimal leaf order
 X = randn (30, 2);
 D = pdist (X);
 y = linkage (D, "average");
 order = optimalleaforder (y, D);
 subplot (2, 1, 1);
 title ("original leaf order");
 dendrogram (y);
 subplot (2, 1, 2);
 title ("optimal leaf order");
 dendrogram (y, "Reorder", order);
                     | 
 
                  | 
 ## horizontal orientation and labels
 X = randn (8, 2);
 D = pdist (X);
 L = ["Snow White"; "Doc"; "Grumpy"; "Happy"; "Sleepy"; "Bashful"; ...
      "Sneezy"; "Dopey"];
 y = linkage (D, "average");
 dendrogram (y, "Orientation", "left", "Labels", L);
 title ("horizontal orientation and labels");
                     | 
