Questions tagged [dendrogram]

A dendrogram (or tree diagram) is a graph used to represent relationships in hierarchical clustering.

Tag usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique.
Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

586 questions
7
votes
2 answers

How to plot scipy.hierarchy.dendrogram using polar coordinates?

I'm trying to adapt the following resources to this question: Python conversion between coordinates https://matplotlib.org/gallery/pie_and_polar_charts/polar_scatter.html I can't seem to get the coordinates to transfer the dendrogram shape over to…
O.rka
  • 29,847
  • 68
  • 194
  • 309
7
votes
2 answers

Getting a node stack overflow error while trying to print a dendrogram

I'm trying to get the heights of internal nodes of a dendrogram in a BFS order. The utils::str function prints the dendrogram in a BFS order., so I thought I'd use that (redirect the output to a file and do some parsing on that to get the info I…
dan
  • 6,048
  • 10
  • 57
  • 125
7
votes
2 answers

Dendrogram with Corrplot (R)

Does anyone have a method to adorn an R corrplot correlation plot with a dendrogram?
abalter
  • 9,663
  • 17
  • 90
  • 145
7
votes
1 answer

How to visualize (dendrogram) a dictionary of hierarchical items?

This is my first time of doing visualization from hierarchical data in dictionary format with Python. Last part of the data looks like this: d = {^2820: [^391, ^1024], ^2821: [^759, 'w', ^118, ^51], ^2822: [^291, 'o'], ^2823: [^25, ^64], ^2824:…
MarkokraM
  • 980
  • 1
  • 12
  • 26
7
votes
2 answers

How to change dendrogram labels in r

I have a dendrogram in R. It is based on hierachical clustering using hclust. I am colouring labels that are different in different colours, but when I try changing the labels of my dedrogram (to the rows of the dataframe the cluster is based on)…
sequence_hard
  • 5,115
  • 10
  • 30
  • 50
7
votes
2 answers

How to colour the labels of a dendrogram by an additional factor variable in R

I have produced a dendrogram after running hierarchical clustering analysis in R using the below code. I am now trying to colour the labels according to another factor variable, which is saved as a vector. The closest that I have come to achieving…
jjulip
  • 1,093
  • 4
  • 16
  • 24
7
votes
2 answers

Scipy dendrogram leaf label colours

Is it possible to assign colours to leaf labels of dendrogram plots from Scipy? I can't figure it out from the documentation. Here's what I've tried so far: from scipy.spatial.distance import pdist, squareform from scipy.cluster.hierarchy import…
herrfz
  • 4,814
  • 4
  • 26
  • 37
7
votes
1 answer

Displaying TraMineR (R) dendrograms in text/table format

I use the following R code to generate a dendrogram (see attached picture) with labels based on TraMineR sequences: library(TraMineR) library(cluster) clusterward <- agnes(twitter.om, diss = TRUE, method = "ward") plot(clusterward, which.plots = 2,…
histelheim
  • 4,938
  • 6
  • 33
  • 63
7
votes
1 answer

cluster presentation dendrogram alternative in r

I know dendrograms are quite popular. However if there are quite large number of observations and classes it hard to follow. However sometime I feel that there should be better way to present the same thing. I got an idea but do not know how to…
fprd
  • 621
  • 7
  • 21
6
votes
2 answers

Dendogram Coloring by groups

I created a heatmap based on spearman's correlation matrix using seaborn clustermap as folowing: I want to paint the dendrogram. I want the dendrogram to look like this: dendrogram but on the heatmap I created a dict of colors as folowing and got an…
6
votes
1 answer

Plot the dendrogram of communities found by NetworkX Girvan-Newman algorithm

The Girvan-Newman algorithm for community detection in networks: detects communities by progressively removing edges from the original graph. The algorithm removes the “most valuable” edge, traditionally the edge with the highest betweenness…
Giora Simchoni
  • 3,487
  • 3
  • 34
  • 72
6
votes
1 answer

Converting igraph to networkx for clustering

I have a python code which uses igraph library import igraph edge = [(0, 6), (0, 8), (0, 115), (0, 124), (0, 289), (0, 359), (0, 363), (6, 60), (6, 115), (6, 128), (6, 129), (6, 130), (6, 131), (6, 359), (6, 529), (8, 9), (8, 17), (8, 115)] G =…
Dgstah
  • 181
  • 2
  • 11
6
votes
3 answers

Change Dendrogram leaves

I want to modify the properties of the leaves in a dendrogram produced from plot of an hclust object. Minimally, I want to change the colors, but any help you can provide will be appreciated. I did try to google the answer, but but every solution…
Btibert3
  • 38,798
  • 44
  • 129
  • 168
6
votes
1 answer

Visualize lowest nodes in hierarchical clustering with dendrogram

I'm using linkage to generate an agglomerative hierarchical clustering for a dataset of around 5000 instances. I want to visualize the 'bottom' merges in the hierarchy, that is, the nodes close to the leaves with the smallest distance measures.…
Cecilia
  • 4,512
  • 3
  • 32
  • 75
6
votes
1 answer

Dendrogram edge (branch) colors to match tip (leaf) colors (ape package)

I'm trying to add color to the edges (lines) of a phylogeny-type plot in R using the plot.phylo command from the ape package. This example is for a "fan" type plot, though I expect the approach would be the same with a "phylogram type" or…
David Roberts
  • 617
  • 1
  • 11
  • 23