Questions tagged [dendextend]

Questions on the R package dendextend

The dendextend R package includes functions and methods for extending dendrogram objects in R (visualization, manipulation and comparison).

158 questions
24
votes
6 answers

How do you compare the "similarity" between two dendrograms (in R)?

I have two dendrograms which I wish to compare to each other in order to find out how "similar" they are. But I don't know of any method to do so (let alone a code to implement it, say, in R). Any leads ? UPDATE (2014-09-13): Since asking this…
Tal Galili
  • 24,605
  • 44
  • 129
  • 187
24
votes
5 answers

Colorize Clusters in Dendogram with ggplot2

Didzis Elferts showed how to plot a dendogram using ggplot2 and ggdendro: horizontal dendrogram in R with labels here is the code: labs = paste("sta_",1:50,sep="") #new labels rownames(USArrests)<-labs #set new row names hc <-…
feder80
  • 1,195
  • 3
  • 13
  • 34
17
votes
2 answers

Label and color leaf dendrogram

I am trying to create a dendrogram, were my samples have 5 group codes (act as sample name/species/etc but its repetitive). Therefore, I have two issues that a help will be great: How can I show the group codes in leaf label (instead of the sample…
lroca
  • 621
  • 2
  • 8
  • 19
13
votes
3 answers

Extract labels membership / classification from a cut dendrogram in R (i.e.: a cutree function for dendrogram)

I'm trying to extract a classification from a dendrogram in R that I've cut at a certain height. This is easy to do with cutree on an hclustobject, but I can't figure out how to do it on a dendrogram object. Further, I can't just use my clusters…
Oreotrephes
  • 447
  • 1
  • 4
  • 10
10
votes
2 answers

Plotting tanglegrams subplots in R using dendextend

I am plotting Tanglegrams in R using dendextend. I am wondering if it is possible to plot multiple subplots using par(mfrow = c(2,2))? I can't seem to figure it out. Thanks library(dendextend) dend15 <- c(1:5) %>% dist %>% hclust(method = "average")…
user2861089
  • 1,205
  • 4
  • 22
  • 44
10
votes
2 answers

Extract cluster color from output of dendextend::circlize_dendrogram()

I am trying to extract the colors used in the clustering of circlize_dendrogram. Here is a sample codes: library(magrittr) library(dendextend) cols <- c("#009000", "#FF033E", "#CB410B", "#3B444B", "#007FFF") dend <- iris[1:40,-5] %>% dist %>%…
Al-Ahmadgaid Asaad
  • 1,172
  • 5
  • 13
  • 25
10
votes
3 answers

How to create a dendrogram with colored branches?

I would like to create a dendrogram in R which has colored branches, like the one shown below. So far I used following commands to create a standard dendrogram: d <- dist(as.matrix(data[,29])) # find distance matrix hc <- hclust(d) …
beginner
8
votes
3 answers

Tree cut and Rectangles around clusters for a horizontal dendrogram in R

I am trying to plot the results of a hierarchical clustering in R as a dendrogram, with rectangles identifying clusters. The following code does the trick for a vertical dendrogram, but for a horizontal dendrogram, (horiz=TRUE), the rectangles are…
Crops
  • 5,024
  • 5
  • 38
  • 65
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
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
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

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
6
votes
3 answers

How to color the branches and tick labels in the heatmap.2?

I have done a Heat Map using the function heatmap.2 of gplots in R, but I don't have an idea of how to coloring the branches and tick labels per groups (Eg. if I cut the tree to have four gruops like in my second figure). I have checked that it is…
Darwin PC
  • 871
  • 3
  • 23
  • 34
6
votes
1 answer

larger font and spacing between leaves in R dendrogram

I have a dendrogram in R that I just can't get it right. I'll show you what the problem is, please check this: http://img.photobucket.com/albums/v699/rica01/Rplot-1.png How can I make the labels on the leaves, bigger and more spaced between…
rica01
  • 69
  • 2
  • 6
1
2 3
10 11