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

merging two dendrograms at a specific node

I would like to either: remove a subtree and then merge a new subtree to the original dendrogram so that it is in the same position as the one removed. or replace a subtree with another one. I know that merge() can merge two dendrograms at the…
user1562626
  • 125
  • 1
  • 7
1
vote
0 answers

How to create a tanglegram in R that connects two dendrograms cut through a given number of clusters?

I have two dendrograms resulting from hierarchical clustering and I want to visually compare them using a tanglegram. However, I only want to display a certain number of clusters that are cut at a predefined level. How can I achieve this in R?
Ivan Z
  • 1,517
  • 1
  • 16
  • 25
1
vote
0 answers

How to extract raw data coordinates and start/stop position of branches from an R Dendrogram using dendextend package

I am currently using the dendextend R package to export the data from an R dendrogram. I am specifically looking to extract the coordinates of each of the nodes in a dendrogram and also the start and stop position of each of the branches. Getting…
Robin Paul
  • 11
  • 1
1
vote
0 answers

Plot dendrogram object converted from hclust while preserving order

Here is a hclust object named hc1a and I want to convert it to a dendrogram object and plot it. # Create hc1a and plot hc1a <- list() hc1a$merge <- matrix(c(-8, -9, -1, -2, -5, 1, …
Patrick
  • 1,057
  • 9
  • 23
1
vote
1 answer

dendextend get_subdendrograms in R: changing label names causes subdendrograms to be NULL

I am trying to create subdendrograms using dendextend, this works until I change the names of the labels of the leaves in the dendrogram. I want the labels to be 'Y' or 'B' based on a column in my dataframe. If I do this it causes several of the…
Chris
  • 53
  • 5
1
vote
0 answers

How to find the highest node per k-group on a dendrogram in R?

I am using dendextend to work with dendrograms in R. I want to only draw nodes that sit at the highest height within each cluster, which is determined by a tree cut @ k value. I wonder, if there is a convenient way to do that? Reproducible example…
perechen
  • 125
  • 9
1
vote
1 answer

Dendogram different colours by label name

Hope you are all doing good. I use a dendogram: d <- dist(Correlation_Test) hc <- hclust(d, "ave") plot(hc) It works fine and shows at the End the dendogram. Dendogram has different labels. Some of them with the prefix A some with B. I want…
Gregor O
  • 9
  • 2
1
vote
0 answers

Rotating dendogram branches when you have thousands of them

I have been working with the R package dendextend for producing a dendogram while being able to rotate some of its branches. What I have is a dendrogram with more than 8000 branches. I want to flip some of the main ones, basically pivoting their…
zvittorio
  • 11
  • 3
1
vote
1 answer

Adding group information to pvclust dendrogram instead of sample name

This is what I'm doing mat <- read.table("Model_pvclust/Model18_FAB_M5_vs_M0_MAP_TF.txt",sep = "\t",strip.white = FALSE,check.names = FALSE,header=TRUE,row.names=1) drop <-…
PesKchan
  • 868
  • 6
  • 14
1
vote
0 answers

R: circlize_dendrogram(): ERROR - Not all labels are unique. Therefore, we pad the labels with a running number, so to be able to produce the plot

Issue I want to produce a "fan" shaped dendrogram using the function circlize_dendrogram() in the package circlize. I would like to cluster the branches and tips by dolphin whistle subtypes (see tip labels below) measured from a spectrogram and then…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
1
vote
1 answer

Changing the Tip Labels on a Dendrogram "Type = Fan" Based on a Defined Group in R Using the Ape Package

Issue: I have a data frame called Sub_Whistle_Count (see below). I'm trying to do a hierarchical analysis using hclust(), but I can't customise the right label names Whistle_Type_Sub (28 different whistle subtypes produced by dolphins) to appear in…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
1
vote
1 answer

Saving dendrograms modified with dendextend in R

I want to rotate the order of several groups in a dendrogram and managed to do it with dendextend. However, when I try to save the plot with ggsave I end up with the original dendrogram, unrotated. Is there a way to save the rotated dendrogram with…
sternegr
  • 13
  • 2
1
vote
1 answer

best way to convert dendrogram to ggplot?

I have build up a dendrogram and colored its branches according to their "purity" (whether they only include subjects with a particular value in a factor variable) using the set("by_labels_branches_col") function of the dendextend package. Now, I…
cs-
  • 21
  • 1
  • 3
1
vote
1 answer

How to rotate ylab labels in dendrogram in R?

df <- scale(mtcars) # Standardize the data library("factoextra") library("cluster") dist <- dist(df, method = "euclidean") # df = standardized data hc <- hclust(dist, method = "ward.D2") fviz_dend(hc, k = 4, # Cut in four groups cex =…
washfaq
  • 268
  • 2
  • 12
1
vote
1 answer

Positioning tip labels next to the tips in the dendrogram

I read in a tree (.nex), convert it to dendro class, and plot it using ggdendrogram from ggplot2. How can I position the tip labels next to the tips in the dendrogram and not at the bottom? mytree <- read.nexus('mytree.nex') den_data_mytree <-…
echo
  • 11
  • 3