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
5
votes
1 answer

Extract distances from hclust (hierarchical clustering) object

I would like to calculate how good the fit of my cluster analysis solution for the actual distance scores is. To do that, I need to extract the distance between the stimuli I am clustering. I know that when looking at the dendrogram I can extract…
Esther
  • 441
  • 2
  • 15
5
votes
1 answer

Cutting a dendrogram in R

I am trying to cut this dendrogram into 3 groups: (T24, T1, T17, etc.), (T12, T15, T6, etc.) and (T2, T8, T3, T9) I have tried using cutree(hc, k=3, h=400) , but it continues to make the same groups. Any help is greatly appreciated. Here is my…
derp4herps
  • 51
  • 1
  • 3
5
votes
3 answers

R cut dendrogram into groups with minimum size

Is there an easy way to calculate lowest value of h in cut that produces groupings of a given minimum size? In this example, if I wanted clusters with at least ten members each, I should go with h = 3.80: # using iris data simply for reproducible…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
5
votes
3 answers

How to color a dendrogram's labels according to defined groups? (in R)

I have a numeric matrix in R with 24 rows and 10,000 columns. The row names of this matrix are basically file names from which I have read the data corresponding to each of the 24 rows. Apart from this I have a separate factor list with 24 entires,…
novicegeek
  • 773
  • 2
  • 9
  • 29
5
votes
1 answer

Error in plot.new() when creating PDF in R

When plotting a dendrogram in R, I get a funny error that I've never seen before. Error in plot.new() : cannot open file 'C:\Users\Sun\AppData\Local\Temp\RtmpKSRNuD\pdf12207aa37548', reason No such file or directory I didn't have that error…
madkitty
  • 1,657
  • 6
  • 24
  • 37
5
votes
1 answer

Generating dendrograms from genealogy data in R

Is there any way to generate a dendrogram where each level of the graph represents a generation and only sons of the same father are connected at each level? I'm attempting to use R's hclust and plot functions to generate a dendrogram of father-son…
mattrepl
  • 602
  • 1
  • 6
  • 18
5
votes
1 answer

Pretty dendrograms in R?

My dendrograms are horribly ugly, on the verge of unreadable, and usually look like this: library(TraMineR) library(cluster) data(biofam) lab <- c("P","L","M","LM","C","LC","LMC","D") biofam.seq <- seqdef(biofam[1:500,10:25], states=lab) ccost <-…
histelheim
  • 4,938
  • 6
  • 33
  • 63
5
votes
1 answer

ylim in hclust plot

I have this simple code to draw a dendrogram but the feature ylim seems not to work. So no matter what I set it to it has a y range of [0,0.5] when drawn. Should I use another parameter for setting the ylim when drawing…
hora
  • 845
  • 5
  • 14
  • 25
5
votes
2 answers

Plot horizontal dendrogram with hanging leaves? (R)

I would like to create a dendrogram plot with horizontal labels, but having the leaves hang according to their height, instead of just drop to the edge of the plot. Example: par(mfrow = c(1,2)) hc <- hclust(dist(USArrests), "ave") plot(hc) # a plot…
Tal Galili
  • 24,605
  • 44
  • 129
  • 187
5
votes
1 answer

Generating a heatmap that depicts the clusters in a dataset using hierarchical clustering in R

I am trying to take my dataset which is made up of protein dna interaction, cluster the data and generate a heatmap that displays the resulting data such that the data looks clustered with the clusters lining up on the diagonal. I am able to…
Alos
  • 2,657
  • 5
  • 35
  • 47
5
votes
2 answers

Exporting dendrogram as table in R

I would like to export an hclust-dendrogram from R into a data table in order to subsequently import it into another ("home-made") software. str(unclass(fit)) provides a text overview for the dendrogram, but what I'm looking for is really a numeric…
AnjaM
  • 2,941
  • 8
  • 39
  • 62
4
votes
2 answers

Matching up the output of scipy linkage() and dendrogram()

I'm drawing dendrograms from scratch using the Z and P outputs of code like the following (see below for a fuller example): Z = scipy.cluster.hierarchy.linkage(...) P = scipy.cluster.hierarchy.dendrogram(Z, ..., no_plot=True) and in order to do…
nicolaskruchten
  • 26,384
  • 8
  • 83
  • 101
4
votes
3 answers

How do I label the terminal nodes of a cut dendrogram?

I used the following code to cut the dendrogram at a particular height.The problem I'm having is that when I cut a dendrogram, I can't figure out how to add labels to the nodes.How can I cut a dendrogram with labels using R…
akash
  • 41
  • 1
  • 3
4
votes
1 answer

Problem with margins using plot function with as.dendrogram object

I'm trying to customize a clustering plot using both base R functions and the package "dendextend". Firstly I generate a cluster with the common hclust() function. Then I'm using "dendextend" to color the branches defined by k=groups. Then I'm using…
4
votes
2 answers

How can i plot a truncated dendrogram plot using plotly?

I want to plot a dendrogram plot for hierarchical clustering using plotly and show a small subset of the plot as with the large number of samples the plot can be very dense at the bottom. I have plotted the plot using the plotly wrapper function…
Albin
  • 61
  • 7