Statistics Toolbox | ![]() ![]() |
Syntax
H = dendrogram(Z) H = dendrogram(Z,p) [H,T] = dendrogram(...)
Description
generates a dendrogram plot of the hierarchical, binary cluster tree, H = dendrogram(Z)
Z
. Z
is an (m-1)-by-3 matrix, generated by the linkage
function, where m is the number of objects in the original dataset.
A dendrogram consists of many upside-down, U-shaped lines connecting objects in a hierarchical tree. Except for the Ward linkage (see linkage
), the height of each U represents the distance between the two objects being connected. The output, H
, is a vector of line handles.
generates a dendrogram with only the top p nodes. By default, H = dendrogram(Z,p)
dendrogram
uses 30 as the value of p. When there are more than 30 initial nodes, a dendrogram may look crowded. To display every node, set p = 0
.
[H,T] = dendrogram(...)
generates a dendrogram and returns T
, a vector of size m that contains the cluster number for each object in the original dataset. T
provides access to the nodes of a cluster hierarchy that are not displayed in the dendrogram because they fall below the cutoff value p. For example, to find out which objects are contained in leaf node k
of the dendrogram, use find(T==k)
. Leaf nodes are the nodes at the bottom of the dendrogram that have no other nodes below them.
When there are fewer than p objects in the original data, all objects are displayed in the dendrogram. In this case, T
is the identical map, i.e., T = (1:m)'
, where each node contains only itself.
Example
rand('seed',12); X= rand(100,2); Y= pdist(X,'citiblock'); Z= linkage(Y,'average'); [H, T] = dendrogram(Z); find(T==20) ans = 20 49 62 65 73 96
This output indicates that leaf node 20 in the dendrogram contains the original data points 20, 49, 62, 65, 73, and 96.
See Also
cluster
, clusterdata
, cophenet
, inconsistent
, linkage
, pdist
, squareform
![]() | dcovary | disttool | ![]() |