({{, (RefLink[Dendrogram, paclet:ref/Dendrogram])[{(Subscript[e, 1]),(Subscript[e, 2]),…}] 
constructs a dendrogram from the hierarchical clustering of the elements (Subscript[e, 1]), (Subscript[e, 2]), ….}, {, (RefLink[Dendrogram, paclet:ref/Dendrogram])[{(Subscript[e, 1])->(Subscript[v, 1]),(Subscript[e, 2])->(Subscript[v, 2]),…}]
represents (Subscript[e, i]) with (Subscript[v, i]) in the constructed dendrogram.}, {, (RefLink[Dendrogram, paclet:ref/Dendrogram])[{(Subscript[e, 1]),(Subscript[e, 2]),…}->{(Subscript[v, 1]),(Subscript[v, 2]),…}]
represents (Subscript[e, i]) with (Subscript[v, i]) in the constructed dendrogram.}, {, (RefLink[Dendrogram, paclet:ref/Dendrogram])[\[LeftAssociation](Subscript[label, 1])->(Subscript[e, 1]),(Subscript[label, 2])->(Subscript[e, 2]),…\[RightAssociation]]
represents (Subscript[e, i]) using labels (Subscript[label, i]) in the constructed dendrogram.}, {, (RefLink[Dendrogram, paclet:ref/Dendrogram])[data,orientation]
constructs an oriented dendrogram according to orientation.}, {, (RefLink[Dendrogram, paclet:ref/Dendrogram])[tree] 
constructs the dendrogram corresponding to weighted tree tree. }})

OpenersNotesSection(Spacer1)Details and Options

The data elements (Subscript[e, i]) can be numbers; numeric lists, matrices, or tensors; lists of Boolean elements; strings or images; geo positions or geographical entities; and colors, as well as combinations of these. If the (Subscript[e, i]) are lists, matrices, or tensors, each must have the same dimensions.

By default, (RefLink[Dendrogram, paclet:ref/Dendrogram]) is oriented from top to bottom. Possible orientations are: (RefLink[Top, paclet:ref/Top]), (RefLink[Left, paclet:ref/Left]), (RefLink[Right, paclet:ref/Right]), and (RefLink[Bottom, paclet:ref/Bottom]).

Trees on which to compute (RefLink[Dendrogram, paclet:ref/Dendrogram]) can only be weighted on vertices.

(RefLink[Dendrogram, paclet:ref/Dendrogram]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions and changes:

(RefLink[Dendrogram, paclet:ref/Dendrogram]) evaluated on a weighted tree only displays the graph as a dendrogram, therefore only the options of (RefLink[Graphics, paclet:ref/Graphics]) will change the final result.

By default, (RefLink[Dendrogram, paclet:ref/Dendrogram]) will preprocess the data automatically unless either a (RefLink[DistanceFunction, paclet:ref/DistanceFunction]) or a (RefLink[FeatureExtractor, paclet:ref/FeatureExtractor]) is specified.

(RefLink[ClusterDissimilarityFunction, paclet:ref/ClusterDissimilarityFunction]) defines the intercluster dissimilarity, given the dissimilarities between member elements.

Possible settings for (RefLink[ClusterDissimilarityFunction, paclet:ref/ClusterDissimilarityFunction]) include:

The function f defines a distance from any two clusters.

The function f needs to be a real-valued function of the (RefLink[DistanceMatrix, paclet:ref/DistanceMatrix]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (15)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Obtain a dendrogram from a list of numbers:

Dendrogram[{1,2,5}]

Obtain a dendrogram from a weighted tree:

graph = Graph[{1,2,3}, {1->2, 1->3}, VertexWeight->{10, 0, 0}, VertexLabels->"Name"]

Dendrogram[graph]

Obtain a dendrogram from a list of cities and place the labels on the left:

Dendrogram[{(Entity["Paris", Entity["City",{"Paris","IleDeFrance","France"}], "Entity[\"City\", {\"Paris\", \"IleDeFrance\", \"France\"}]", "city"]),(Entity["Sydney", Entity["City",{"Sydney","NewSouthWales","Australia"}], "Entity[\"City\", {\"Sydney\", \"NewSouthWales\", \"Australia\"}]", "city"]),(Entity["Boston", Entity["City",{"Boston","Massachusetts","UnitedStates"}], "Entity[\"City\", {\"Boston\", \"Massachusetts\", \"UnitedStates\"}]", "city"]),(Entity["San Francisco", Entity["City",{"SanFrancisco","California","UnitedStates"}], "Entity[\"City\", {\"SanFrancisco\", \"California\", \"UnitedStates\"}]", "city"])}, Left]

Obtain a cluster hierarchy from a list of Boolean entries:

Dendrogram[{{False, False, True}, {True, True, False}, {False,True, True}, {False, False, False}}]

OpenersExampleSection1(Spacer1)Scope  (7)

Obtain a dendrogram from a list of colors and display it to the left:

Dendrogram[{,,,,,,,,},Left]

Compare the result with (RefLink[Dendrogram, paclet:ref/Dendrogram]) applied to the result of (RefLink[ClusteringTree, paclet:ref/ClusteringTree]):

c = ClusteringTree[{,,,,,,,,}];

Dendrogram[c, Left]

Obtain a dendrogram from a heterogeneous dataset:

data = {{, "brown"},{, "light blue"},{, "blue"},{, "violet"},{, "light blue"},{, "yellow"},{, "light violet"}};

Dendrogram[data, Left]

Compare it with the dendrogram of the colors:

Dendrogram[data[[All, 1]], Left]

Generate a sequence of random reals:

r = RandomReal[1, 20];

Obtain the dendrogram with the labeling given by the rounded reals:

Dendrogram[r->Round[r, .1]]

Compute the dendrogram from an (RefLink[Association, paclet:ref/Association]):

association = <|"this color is red"->, "this color is blue"->, "this color is pink"->, "this color is yellow"->|>;

Dendrogram[association, Left]

Compare it with the dendrogram of its (RefLink[Values, paclet:ref/Values]):

Dendrogram[Values[association], Left]

Compare it with the dendrogram of its (RefLink[Keys, paclet:ref/Keys]):

Dendrogram[Keys[association], Left]

Generate a dendrogram from a list of numbers:

data = Round[RandomReal[{1, 30}, 10], .1];

Dendrogram[data]

Show the y axis to compare distances between subclusters:

Dendrogram[data, Axes->{ False, True}, AxesOrigin->{0,0}]

Generate a dendrogram from a list of vectors:

data = N@RandomInteger[{0, 20}, {10, 5}];

Dendrogram[data]

Display the result using vertical labeling:

Dendrogram[data->(Rotate[ #,3 Pi/2]&/@data)]

Display the result using the (RefLink[ArrayPlot, paclet:ref/ArrayPlot]) of the vectors as labeling:

Dendrogram[data->(Rotate[ArrayPlot[{#}, ColorFunction->"BlueGreenYellow"], 3 Pi/2]&/@data)]

Obtain a dendrogram from a list of images:

l={,,,,,,,};

Dendrogram[l, Right]

OpenersExampleSection2(Spacer1)Options  (3)

Generate a list of random colors:

data = RandomColor[30]

Obtain a cluster hierarchy from the list using the "Centroid" linkage:

Dendrogram[data, ClusterDissimilarityFunction->"Centroid"]

Obtain a cluster hierarchy from the list using the "Single" linkage:

Dendrogram[data, ClusterDissimilarityFunction->"Single"]

Obtain a cluster hierarchy from the list using a different "ClusterDissimilarityFunction":

Dendrogram[data, ClusterDissimilarityFunction->(Max[#]&)]

OpenersExampleSubsection0(Spacer1)DistanceFunction  (1)

Generate a list of random vectors:

data =RandomReal[{10, 20}, {10, 2}];

Obtain a dendrogram using the automatically chosen (RefLink[DistanceFunction, paclet:ref/DistanceFunction]) and plot the y axis:

Dendrogram[data, Axes->{False, True}]

Obtain a dendrogram using the (RefLink[EuclideanDistance, paclet:ref/EuclideanDistance]) and compare the values on the y axis:

Dendrogram[data, DistanceFunction->EuclideanDistance, Axes->{False, True}]

Obtain a dendrogram using a different (RefLink[DistanceFunction, paclet:ref/DistanceFunction]):

Dendrogram[data, DistanceFunction->ManhattanDistance]

Dendrogram[data, DistanceFunction->ChessboardDistance]

OpenersExampleSubsection1(Spacer1)FeatureExtractor  (1)

Obtain a dendrogram from a list of pictures:

flowers ={ ,,,,,,,,,, ,,,,,,,,};

Dendrogram[flowers]

Use a different (RefLink[FeatureExtractor, paclet:ref/FeatureExtractor]) to extract features:

fe = FeatureExtraction[flowers, "ImageFeatures"]

Dendrogram[flowers, FeatureExtractor->fe]

Use the (RefLink[Identity, paclet:ref/Identity]) (RefLink[FeatureExtractor, paclet:ref/FeatureExtractor]) to leave the data unchanged:

Dendrogram[flowers, FeatureExtractor->Identity]

OpenersExampleSection3(Spacer1)Applications  (1)

Generate a list of random colors and compute its dendrogram with the distances on the y axis:

colors ={,,,,,,,,,};

Dendrogram[colors, Axes->{False,True}, AxesOrigin->{0,0}]

Compute the (RefLink[ClusteringTree, paclet:ref/ClusteringTree]) for the same data by merging clusters that are closer than 0.65:

g = ClusteringTree[colors, 0.65]

Compute the (RefLink[Dendrogram, paclet:ref/Dendrogram]) of the above graph:

Dendrogram[g]

Construct a (RefLink[Manipulate, paclet:ref/Manipulate]) to visualize how clusters merge when the distance threshold increases:

With[{colors = {,,,,,,,,,}},Manipulate[Dendrogram[ClusteringTree[colors, h], Left], {h, 0, 1}]
]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ClusteringTree, paclet:ref/ClusteringTree])  ▪  (RefLink[FindClusters, paclet:ref/FindClusters])  ▪  (RefLink[ClusteringComponents, paclet:ref/ClusteringComponents])  ▪  (RefLink[TreePlot, paclet:ref/TreePlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Cluster Analysis, paclet:guide/ClusterAnalysis])}, {▪(RefLinkPlain[Data Visualization, paclet:guide/DataVisualization])}, {▪(RefLinkPlain[Distance and Similarity Measures, paclet:guide/DistanceAndSimilarityMeasures])}, {▪(RefLinkPlain[Machine Learning, paclet:guide/MachineLearning])}, {▪(RefLinkPlain[Life Sciences & Medicine: Data & Computation, paclet:guide/LifeSciencesAndMedicineDataAndComputation])}, {▪(RefLinkPlain[Statistical Data Analysis, paclet:guide/Statistics])}, {▪(RefLinkPlain[Text Analysis, paclet:guide/TextAnalysis])}, {▪(RefLinkPlain[Scientific Data Analysis, paclet:guide/ScientificDataAnalysis])}, {▪(RefLinkPlain[Sequence Alignment & Comparison, paclet:guide/SequenceAlignmentAndComparison])}})}})