Skip to main content
added 1 characters in body; added 1 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

DendogramPlotDendrogramPlot accepts Axes as an option. Despite syntax highlighting in red of Axes and AxesOrigin, GridLines etc. these options seem to work with DendogramPlotDendrogramPlot.

DendogramPlot accepts Axes as an option. Despite syntax highlighting in red of Axes and AxesOrigin, GridLines etc. these options seem to work with DendogramPlot.

DendrogramPlot accepts Axes as an option. Despite syntax highlighting in red of Axes and AxesOrigin, GridLines etc. these options seem to work with DendrogramPlot.

deleted 422 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

In the following, these distances are highlighted in red:

Needs["HierarchicalClustering`"]
Grid[{{Agglomerate[{1, 2, 10, 4, 8},
 DistanceFunction -> Automatic, 
 Linkage -> "Single"]}, 
 {DendrogramPlot[{1, 2, 10, 4, 8},
 DistanceFunction -> Automatic, Linkage -> "Single", 
 LeafLabels -> (# &), ImageSize -> 300, Axes -> {False, True}, 
 AxesOrigin -> {0, Automatic}]}}]

enter image description here

Few moreSeveral combinations of DistanceFunction and Linkage where inter-cluster distances are highlighted in red and shown as green gridlines in the dendogram plot:

 Needs["HierarchicalClustering`"]

Grid[{{ToString@#[[1]] <> "--" <> #[[2]]}, {Replace[
  {Replace[ Agglomerate[{1, 2, 10, 4, 8},
    DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
    Cluster[a_, b_, c_, d__] -> 
    Cluster[a, b, Style[c, 18, Red, Bold], d], {0, 
    Infinity}]}, {DendrogramPlot[{1, 2, 10, 4, 8},
   DistanceFunction -> #[[1]], Linkage -> #[[2]], 
   LeafLabels -> (# &), 
   GridLines -> {None, Cases[Agglomerate[{1, 2, 10, 4, 8},
       DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
      Cluster[a_, b_, c_, d__] :> c, {0, Infinity}]}, 
   GridLinesStyle -> Green, ImageSize -> 500, 
   Axes -> {False, True}, AxesOrigin -> {.75, Automatic}]}}] & /@ 
 Tuples[{{Automatic, ManhattanDistance}, {"Complete",  "Centroid"}}] // Column

EDIT: Note: Despite syntax highlightingWhat I get for Frederik's example in red of Axes and AxesOrigin, the options seem to workcomments:

In the following, these distances are highlighted in red:

Needs["HierarchicalClustering`"]
Grid[{{Agglomerate[{1, 2, 10, 4, 8},
 DistanceFunction -> Automatic, 
 Linkage -> "Single"]}, 
 {DendrogramPlot[{1, 2, 10, 4, 8},
 DistanceFunction -> Automatic, Linkage -> "Single", 
 LeafLabels -> (# &), ImageSize -> 300, Axes -> {False, True}, 
 AxesOrigin -> {0, Automatic}]}}]

enter image description here

Few more combinations where inter-cluster distances are highlighted in red and shown as green gridlines in the dendogram plot:

 Grid[{{ToString@#[[1]] <> "--" <> #[[2]]}, {Replace[
   Agglomerate[{1, 2, 10, 4, 8},
    DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
   Cluster[a_, b_, c_, d__] -> 
    Cluster[a, b, Style[c, 18, Red, Bold], d], {0, 
    Infinity}]}, {DendrogramPlot[{1, 2, 10, 4, 8},
   DistanceFunction -> #[[1]], Linkage -> #[[2]], 
   LeafLabels -> (# &), 
   GridLines -> {None, Cases[Agglomerate[{1, 2, 10, 4, 8},
       DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
      Cluster[a_, b_, c_, d__] :> c, {0, Infinity}]}, 
   GridLinesStyle -> Green, ImageSize -> 500, 
   Axes -> {False, True}, AxesOrigin -> {.75, Automatic}]}}] & /@ 
 Tuples[{{Automatic, ManhattanDistance}, {"Complete",  "Centroid"}}] // Column

EDIT: Note: Despite syntax highlighting in red of Axes and AxesOrigin, the options seem to work:

Several combinations of DistanceFunction and Linkage where inter-cluster distances are highlighted in red and shown as green gridlines in the dendogram plot:

Needs["HierarchicalClustering`"]

Grid[{{ToString@#[[1]] <> "--" <> #[[2]]}, 
  {Replace[ Agglomerate[{1, 2, 10, 4, 8},
    DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
    Cluster[a_, b_, c_, d__] -> 
    Cluster[a, b, Style[c, 18, Red, Bold], d], {0, 
    Infinity}]}, {DendrogramPlot[{1, 2, 10, 4, 8},
   DistanceFunction -> #[[1]], Linkage -> #[[2]], 
   LeafLabels -> (# &), 
   GridLines -> {None, Cases[Agglomerate[{1, 2, 10, 4, 8},
       DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
      Cluster[a_, b_, c_, d__] :> c, {0, Infinity}]}, 
   GridLinesStyle -> Green, ImageSize -> 500, 
   Axes -> {False, True}, AxesOrigin -> {.75, Automatic}]}}] & /@ 
 Tuples[{{Automatic, ManhattanDistance}, {"Complete",  "Centroid"}}] // Column

EDIT: What I get for Frederik's example in the comments:

added 1103 characters in body; deleted 12 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

DendogramPlot accepts Axes as an option. Despite syntax highlighting in red of Axes and AxesOrigin, GridLines etc. these options seem to work with DendogramPlot.

Inter-cluster distancesdistance in a Cluster object areis given as the third from last element.

Few more combinations where inter-cluster distances are highlighted in red and shown as green gridlines in the dendogram plot:

 Grid[{{ToString@#[[1]] <> "--" <> #[[2]]}, {Replace[
   Agglomerate[{1, 2, 10, 4, 8},
    DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
   Cluster[a_, b_, c_, d__] -> 
    Cluster[a, b, Style[c, 18, Red, Bold], d], {0, 
    Infinity}]}, {DendrogramPlot[{1, 2, 10, 4, 8},
   DistanceFunction -> #[[1]], Linkage -> #[[2]], 
   LeafLabels -> (# &), 
   GridLines -> {None, Cases[Agglomerate[{1, 2, 10, 4, 8},
       DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
      Cluster[a_, b_, c_, d__] :> c, {0, Infinity}]}, 
   GridLinesStyle -> Green, ImageSize -> 500, 
   Axes -> {False, True}, AxesOrigin -> {.75, Automatic}]}}] & /@ 
 Tuples[{{Automatic, ManhattanDistance}, {"Complete",  "Centroid"}}] // Column

enter image description here

So ... this verifies that verticalvertical axis does indeed measure the inter-cluster distances for a given DistanceFunction and Linkage.

DendogramPlot accepts Axes as an option.

Inter-cluster distances in a Cluster object are given as the third from last element.

So ... this verifies that vertical axis does indeed measure the inter-cluster distances for a given DistanceFunction and Linkage.

DendogramPlot accepts Axes as an option. Despite syntax highlighting in red of Axes and AxesOrigin, GridLines etc. these options seem to work with DendogramPlot.

Inter-cluster distance in a Cluster object is given as the third element.

Few more combinations where inter-cluster distances are highlighted in red and shown as green gridlines in the dendogram plot:

 Grid[{{ToString@#[[1]] <> "--" <> #[[2]]}, {Replace[
   Agglomerate[{1, 2, 10, 4, 8},
    DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
   Cluster[a_, b_, c_, d__] -> 
    Cluster[a, b, Style[c, 18, Red, Bold], d], {0, 
    Infinity}]}, {DendrogramPlot[{1, 2, 10, 4, 8},
   DistanceFunction -> #[[1]], Linkage -> #[[2]], 
   LeafLabels -> (# &), 
   GridLines -> {None, Cases[Agglomerate[{1, 2, 10, 4, 8},
       DistanceFunction -> #[[1]], Linkage -> #[[2]]], 
      Cluster[a_, b_, c_, d__] :> c, {0, Infinity}]}, 
   GridLinesStyle -> Green, ImageSize -> 500, 
   Axes -> {False, True}, AxesOrigin -> {.75, Automatic}]}}] & /@ 
 Tuples[{{Automatic, ManhattanDistance}, {"Complete",  "Centroid"}}] // Column

enter image description here

So ... vertical axis does indeed measure the inter-cluster distances for a given DistanceFunction and Linkage.

added 37 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 1142 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 249 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 437 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading