dendextend: Extending 'Dendrogram' Functionality in R

Offers a set of functions for extending 'dendrogram' objects in R, letting you visualize and compare trees of 'hierarchical clusterings'. You can (1) Adjust a tree's graphical parameters - the color, size, type, etc of its branches, nodes and labels. (2) Visually and statistically compare different 'dendrograms' to one another.

Install the latest version of this package by entering the following in R:
AuthorTal Galili [aut, cre, cph] (, Gavin Simpson [ctb], Gregory Jefferis [aut, ctb] (imported code from his dendroextras package), Marco Gallotta [ctb] (a.k.a: marcog), Johan Renaudie [ctb] (, The R Core Team [ctb] (Thanks for the Infastructure, and code in the examples), Kurt Hornik [ctb], Uwe Ligges [ctb], Andrej-Nikolai Spiess [ctb], Steve Horvath [ctb], Peter Langfelder [ctb], skullkey [ctb], Mark Van Der Loo [ctb] ( d3dendrogram), Andrie de Vries [ctb] (ggdendro author), Zuguang Gu [ctb] (circlize author), Cath [ctb] (, Yoav Benjamini [ths]
Date of publication2017-03-28 08:45:38 UTC
MaintainerTal Galili <>
LicenseGPL-2 | GPL-3

View on CRAN

Man pages

all_couple_rotations_at_k: Rotate tree branches for k

all.equal.dendrogram: Global Comparison of two (or more) dendrograms

all_unique: Check if all the elements in a vector are unique

as.dendlist: Try to coerce something into a dendlist

as_hclust_fixed: Convert dendrogram Objects to Class hclust

as.phylo.dendrogram: Convert a dendrogram into phylo

assign_dendextend_options: Populates dendextend functions into dendextend_options

assign_values_to_branches_edgePar: Assign values to edgePar of dendrogram's branches

assign_values_to_leaves_edgePar: Assign values to edgePar of dendrogram's leaves

assign_values_to_leaves_nodePar: Assign values to nodePar of dendrogram's leaves

assign_values_to_nodes_nodePar: Assign values to nodePar of dendrogram's nodes

bakers_gamma_for_2_k_matrix: Bakers Gamma for two k matrices

Bk: Bk - Calculating Fowlkes-Mallows Index for two dendrogram

Bk_permutations: Bk permutation - Calculating Fowlkes-Mallows Index for two...

Bk_plot: Bk plot - ploting the Fowlkes-Mallows Index of two dendrogram...

branches_attr_by_clusters: Change col/lwd/lty of branches based on clusters

branches_attr_by_labels: Change col/lwd/lty of branches matching labels condition

circlize_dendrogram: Plot a circlized dendrograms

click_rotate: Interactively rotate a tree object

collapse_branch: Collapse branches under a tolerance level

color_branches: Color tree's branches according to sub-clusters

colored_bars: Add colored bars to a dendrogram

color_labels: Color dend's labels according to sub-clusters

color_unique_labels: Color unique labels in a dendrogram

common_subtrees_clusters: Find clusters of common subtrees

cor_bakers_gamma: Baker's Gamma correlation coefficient

cor_common_nodes: Proportion of commong nodes between two trees

cor_cophenetic: Cophenetic correlation between two trees

cor.dendlist: Correlation matrix between a list of trees.

cor_FM_index: Correlation of FM_index for some k

count_terminal_nodes: Counts the number of terminal nodes (merging 0 nodes!)

cut_lower_fun: Cut a dendrogram - and run a function on the output

cutree_1h.dendrogram: cutree for dendrogram (by 1 height only!)

cutree_1k.dendrogram: cutree for dendrogram (by 1 k value only!)

cutree-methods: Cut a Tree (Dendrogram/hclust/phylo) into Groups of Data

d3dendrogram: Plot dendrogram to webpage and view.

d3dendro_options: Get or set current defaults for d3dendrogram

dend_diff: Plots two trees side by side, highlighting edges unique to...

dendextend_labels.dendrogram: Labels of the Leaves in a Dendrogram

dendextend_options: Access to dendextend_options

dendextend-package: Functions for extending dendrogram objects

dendlist: Creating a dendlist object from several dendrograms

DendSer.dendrogram: Tries to run DendSer on a dendrogram

dist.dendlist: Topological Distances Between Two dendrograms

distinct_edges: Finds distinct edges in one tree compared to another

dist_long: Turns a dist object to a "long" table

duplicate_leaf: Duplicate a leaf X times

entanglement: Measures entanglement between two trees

fac2num: Turns a factor into a number

find_dend: Finds a "good" dendrogram for a dist

find_k: Find the (estimated) number of clusters for a dendrogram...

fix_members_attr.dendrogram: Fix members attr in a dendrogram

flatten.dendrogram: Flatten the branches of a dendrogram's root

flip_leaves: Flip leaves

FM_index: Calculating Fowlkes-Mallows Index

FM_index_permutation: Calculating Fowlkes-Mallows Index under H0

FM_index_profdpm: Calculating Fowlkes-Mallows index using the profdpm R package

FM_index_R: Calculating Fowlkes-Mallows index in R

get_branches_heights: Get height attributes from a dendrogram

get_childrens_heights: Get height attributes from a dendrogram's children

get_leaves_attr: Get/set attributes of dendrogram's leaves

get_leaves_branches_attr: Get an attribute of the branches of a dendrogram's leaves

get_leaves_branches_col: Get the colors of the branches of a dendrogram's leaves

get_leaves_edgePar: Get edgePar of dendrogram's leaves

get_leaves_nodePar: Get nodePar of dendrogram's leaves

get_nodes_attr: Get attributes of dendrogram's nodes

get_nodes_xy: Get the x-y coordinates of a dendrogram's nodes

get_root_branches_attr: get attributes from the dendrogram's root(!) branches

ggdend: Creates dendrogram plot using ggplot.

hang.dendrogram: Hang dendrogram leaves

has_component_in_attribute: Does a dendrogram has an edgePar/nodePar component?

heights_per_k.dendrogram: Which height will result in which k for a dendrogram

highlight_branches: Highlight a dendrogram's branches heights via color and...

highlight_distinct_edges: Highlight distint edges in a tree (compared to another one)

identify.dendrogram: Identify Clusters in a Dendrogram (not hclust)

intersect_trees: Intersect trees

is.natural.number: Check if numbers are natural

is_null_list: Checks if the value is and empty list()

is_some_class: Is the object of some class

khan: Microarray gene expression dataset from Khan et al., 2001....

labels-assign: "label" assignment operator

labels_cex: Retrieve/assign cex to the labels of a dendrogram

labels_colors: Retrieve/assign colors to the labels of a dendrogram

ladderize: Ladderize a Tree

leaf_Colors: Return the leaf Colors of a dendrogram

lowest_common_branch: Find lowest common branch were the two items are shared

match_order_by_labels: Adjust the order of one dendrogram based on another (using...

match_order_dendrogram_by_old_order: Adjust the order of one dendrogram based on another (using...

na_locf: Last Observation Carried Forward

nleaves: Counts the number of leaves in a tree

nnodes: Counts the number of nodes (Vertices) in a tree

noded_with_condition: Find which nodes satisfies a condition

order.dendrogram-assign: order.dendrogram<- assignment operator

order.hclust: Ordering of the Leaves in a hclust Dendrogram

partition_leaves: A list with labels for each subtree (edge)

plot_horiz.dendrogram: Plotting a left-tip-adjusted horizontal dendrogram

prune: Prunes a tree (using leaves' labels)

prune_common_subtrees.dendlist: Prune trees to their common subtrees

prune_leaf: Trims one leaf from a dendrogram

pvclust_show_signif: The significant branches in a dendrogram, based on a pvclust...

pvclust_show_signif_gradient: Significance gradient of branches in a dendrogram (via...

raise.dendrogram: Raise the height of a dendrogram tree

rank_branches: Rank branches' heights

rank_order.dendrogram: Fix rank of leaves order values in a dendrogram

rank_values_with_clusters: Rank a vector based on clusters

rect.dendrogram: Draw Rectangles Around a Dendrogram's Clusters

reexports: Objects exported from other packages

remove_branches_edgePar: Remove all edgePar values from a dendrogram's branches

remove_leaves_nodePar: Remove all nodePar values from a dendrogram's leaves

remove_nodes_nodePar: Remove all nodePar values from a dendrogram's nodes

rllply: recursivly apply a function on a list

rotate: Rotate a tree object

rotate_DendSer: Rotates dend based on DendSer

sample.dendrogram: Sample a tree

seriate_dendrogram: Rotates a dendrogram based on a seriation of a distance...

set: Set (/update) features to a dendrogram

set_labels: Set/place new labels in a dendrogram

shuffle: Random rotation of trees

sort_2_clusters_vectors: Sorts two clusters vector by their names

sort_dist_mat: Sorts a distance matrix by rows and columns names

sort_levels_values: Sort the values level in a vector

tanglegram: Tanglegram plot

theme_dendro: Creates completely blank theme in ggplot

unbranch: unbranch trees

unclass_dend: unclass an entire dendrogram tree

untangle: untangle dendrograms

untangle_DendSer: Tries to run DendSer on a dendrogram

untangle_random_search: Untangle - random search

untangle_step_rotate_1side: Stepwise untangle one tree compared to another

untangle_step_rotate_2side: Stepwise untangle two trees one at a time

which_leaf: Which node is a leaf?

which_node: Which node id is common to a group of labels


\%>\% Man page
all_couple_rotations_at_k Man page
all.equal.dendlist Man page
all.equal.dendrogram Man page
all_unique Man page
as.dendlist Man page
as.ggdend Man page
as.ggdend.dendrogram Man page
as_hclust_fixed Man page
as.phylo.dendrogram Man page
assign_dendextend_options Man page
assign_values_to_branches_edgePar Man page
assign_values_to_leaves_edgePar Man page
assign_values_to_leaves_nodePar Man page
assign_values_to_nodes_nodePar Man page
bakers_gamma_for_2_k_matrix Man page
Bk Man page
Bk_permutations Man page
Bk_plot Man page
branches_attr_by_clusters Man page
branches_attr_by_labels Man page
branches_color Man page
circlize_dendrogram Man page
click_rotate Man page
click_rotate.default Man page
click_rotate.dendrogram Man page
collapse_branch Man page
color_branches Man page
colored_bars Man page
color_labels Man page
color_unique_labels Man page
colour_branches Man page
colour_labels Man page
common_subtrees_clusters Man page
cor_bakers_gamma Man page
cor_bakers_gamma.default Man page
cor_bakers_gamma.dendlist Man page
cor_bakers_gamma.dendrogram Man page
cor_bakers_gamma.hclust Man page
cor_common_nodes Man page
cor_cophenetic Man page
cor_cophenetic.default Man page
cor_cophenetic.dendlist Man page
cor.dendlist Man page
cor_FM_index Man page
count_terminal_nodes Man page
cut_lower_fun Man page
cutree Man page
cutree_1h.dendrogram Man page
cutree_1k.dendrogram Man page
cutree.default Man page
cutree.dendrogram Man page
cutree.hclust Man page
cutree.phylo Man page
d3dendrogram Man page
d3dendro_options Man page
dendbackback Man page
dend_diff Man page
dend_diff.dendlist Man page
dend_diff.dendrogram Man page
dend_expend Man page
dendextend Man page
dendextend_cut_lower_fun Man page
dendextend_get_branches_heights Man page
dendextend_heights_per_k.dendrogram Man page
dendextend_labels.dendrogram Man page
dendextend_options Man page
dendextend-package Man page
dendlist Man page
DendSer.dendrogram Man page
dist.dendlist Man page
distinct_edges Man page
dist_long Man page
duplicate_leaf Man page
entanglement Man page
entanglement.dendlist Man page
entanglement.dendrogram Man page
entanglement.hclust Man page
entanglement.phylo Man page
fac2num Man page
find_dend Man page
find_k Man page
fix_members_attr.dendrogram Man page
flatten.dendrogram Man page
flip_leaves Man page
FM_index Man page
FM_index_permutation Man page
FM_index_profdpm Man page
FM_index_R Man page
get_branches_heights Man page
get_childrens_heights Man page
get_leaves_attr Man page
get_leaves_branches_attr Man page
get_leaves_branches_col Man page
get_leaves_edgePar Man page
get_leaves_nodePar Man page
get_nodes_attr Man page
get_nodes_xy Man page
get_root_branches_attr Man page
ggdend Man page
ggplot.dendrogram Man page
ggplot.ggdend Man page
hang.dendrogram Man page
has_component_in_attribute Man page
has_edgePar Man page
has_nodePar Man page
heights_per_k.dendrogram Man page
highlight_branches Man page
highlight_branches_col Man page
highlight_branches_lwd Man page
highlight_distinct_edges Man page
highlight_distinct_edges.dendlist Man page
highlight_distinct_edges.dendrogram Man page
identify.dendrogram Man page
intersect_trees Man page
is.dendlist Man page
is.dendrogram Man page
is.dist Man page
is.hclust Man page
is.natural.number Man page
is_null_list Man page
is.phylo Man page
is_some_class Man page
khan Man page
labels<- Man page
labels_cex Man page
labels_cex<- Man page
labels_col Man page
labels_colors Man page
labels_colors<- Man page
labels<-.default Man page
labels<-.dendrogram Man page
labels<-.hclust Man page
labels.hclust Man page
labels<-.phylo Man page
labels.phylo Man page
ladderize Man page
ladderize.dendlist Man page
ladderize.dendrogram Man page
ladderize.phylo Man page
leaf_colors Man page
leaf_Colors Man page
lowest_common_branch Man page
match_order_by_labels Man page
match_order_dendrogram_by_old_order Man page
na_locf Man page
nleaves Man page
nleaves.default Man page
nleaves.dendlist Man page
nleaves.dendrogram Man page
nleaves.hclust Man page
nleaves.phylo Man page
nnodes Man page
nnodes.default Man page
nnodes.dendrogram Man page
nnodes.hclust Man page
nnodes.phylo Man page
noded_with_condition Man page
order.dendrogram<- Man page
order.hclust Man page
partition_leaves Man page
place_labels Man page
plot.dendlist Man page
plot.find_k Man page
plot_horiz.dendrogram Man page
prepare.ggdend Man page
prune Man page
prune_common_subtrees.dendlist Man page
prune.default Man page
prune.dendrogram Man page
prune.hclust Man page
prune_leaf Man page
prune.phylo Man page
prune.rpart Man page
pvclust_show_signif Man page
pvclust_show_signif_gradient Man page
raise.dendrogram Man page
rank_branches Man page
rank_order.dendrogram Man page
rank_values_with_clusters Man page
rect.dendrogram Man page
reexports Man page
remove_branches_edgePar Man page
remove_leaves_nodePar Man page
remove_nodes_nodePar Man page
rev.hclust Man page
rllply Man page
rotate Man page
rotate.default Man page
rotate.dendrogram Man page
rotate_DendSer Man page
rotate.hclust Man page
rotate.phylo Man page
sample.dendrogram Man page
seriate_dendrogram Man page
set Man page Man page
set.dendlist Man page
set.dendrogram Man page
set_labels Man page
shuffle Man page
shuffle.default Man page
shuffle.dendlist Man page
shuffle.dendrogram Man page
shuffle.hclust Man page
shuffle.phylo Man page
sort_2_clusters_vectors Man page
sort.dendlist Man page
sort.dendrogram Man page
sort_dist_mat Man page
sort.hclust Man page
sort_levels_values Man page
tanglegram Man page
tanglegram.default Man page
tanglegram.dendlist Man page
tanglegram.dendrogram Man page
tanglegram.hclust Man page
tanglegram.phylo Man page
theme_dendro Man page
unbranch Man page
unbranch.default Man page
unbranch.dendrogram Man page
unbranch.hclust Man page
unbranch.phylo Man page
unclass_dend Man page
untangle Man page
untangle.default Man page
untangle.dendlist Man page
untangle.dendrogram Man page
untangle_DendSer Man page
untangle_labels Man page
untangle_random_search Man page
untangle_step_rotate_1side Man page
untangle_step_rotate_2side Man page
which_leaf Man page
which_node Man page


tests/testthat/test-entanglement.R tests/testthat/test-dendlist.R tests/testthat/test-cor_bakers_gamma.R tests/testthat/test-rotate.R tests/testthat/test-bk_method.R tests/testthat/test-attr_access.R tests/testthat/test-ggdend.R tests/testthat/test-cutree.dendrogram.R tests/testthat/test-set.dendrogram.R tests/testthat/test-cut_lower_fun.R tests/testthat/test-trim.R tests/testthat/test-untangle.R tests/testthat/test-rect.dendrogram.R tests/testthat/test-labels_colors.R tests/testthat/test-distinct_edges.R tests/testthat/test-nleaves.R tests/testthat/test-general.R tests/testthat/test-unbranch.R tests/testthat/test-labels-assign.R tests/testthat/test-common_subtrees.R tests/testthat/test-branches_attr_by.R tests/testthat/test-cor_cophenetic.R tests/test-all.R
R/pvclust.R R/cut_lower_fun.R R/rect.dendrogram.R R/attr_access.R R/cutree.dendrogram.R R/dendextend-package.R R/is.functions.R R/noded_with_condition.R R/nleaves.R R/d3dendrogram.R R/DendSer.R R/all.equal.R R/cor_bakers_gamma.R R/ggdend.R R/colored_bars.R R/circlize.R R/labels_colors.R R/sample.dendrogram.R R/cor_cophenetic.R R/seriate_dendrogram.R R/highlight_branches.R R/dendlist.R R/magrittr.R R/common_subtrees.R R/entanglement.R R/data.R R/stats_imports.R R/rotate.R R/dist_long.R R/Hmisc.R R/distinct_edges.R R/ggdendro.R R/dendextend.R R/tanglegram.R R/set.dendrogram.R R/bk_method.R R/has_edgePar.R R/color_branches.R R/ape.R R/untangle.R R/as.dendrogram.randomForest.R R/branches_attr_by.R R/unbranch.R R/labels.R R/cor.dendlist.R R/get_nodes_xy.R R/rainbow_fun.R R/prune.R R/dendextend_options.R R/zzz.R R/find_k.R R/find_dend.R
man/remove_leaves_nodePar.Rd man/remove_branches_edgePar.Rd man/rank_order.dendrogram.Rd man/labels_colors.Rd man/dist.dendlist.Rd man/get_root_branches_attr.Rd man/set.Rd man/rllply.Rd man/sample.dendrogram.Rd man/dist_long.Rd man/highlight_distinct_edges.Rd man/cor_common_nodes.Rd man/pvclust_show_signif.Rd man/nleaves.Rd man/tanglegram.Rd man/as.phylo.dendrogram.Rd man/order.hclust.Rd man/partition_leaves.Rd man/get_childrens_heights.Rd man/hang.dendrogram.Rd man/which_leaf.Rd man/FM_index_permutation.Rd man/d3dendrogram.Rd man/color_unique_labels.Rd man/labels-assign.Rd man/leaf_Colors.Rd man/get_nodes_xy.Rd man/click_rotate.Rd man/assign_values_to_branches_edgePar.Rd man/is.natural.number.Rd man/theme_dendro.Rd man/seriate_dendrogram.Rd man/fix_members_attr.dendrogram.Rd man/ggdend.Rd man/khan.Rd man/fac2num.Rd man/raise.dendrogram.Rd man/prune_common_subtrees.dendlist.Rd man/dendlist.Rd man/distinct_edges.Rd man/color_branches.Rd man/assign_values_to_nodes_nodePar.Rd man/flatten.dendrogram.Rd man/get_nodes_attr.Rd man/is_some_class.Rd man/rank_values_with_clusters.Rd man/sort_2_clusters_vectors.Rd man/rotate.Rd man/heights_per_k.dendrogram.Rd man/all_couple_rotations_at_k.Rd man/flip_leaves.Rd man/rank_branches.Rd man/find_dend.Rd man/which_node.Rd man/FM_index_profdpm.Rd man/highlight_branches.Rd man/cor_bakers_gamma.Rd man/identify.dendrogram.Rd man/all.equal.dendrogram.Rd man/assign_dendextend_options.Rd man/untangle_random_search.Rd man/untangle_step_rotate_1side.Rd man/dendextend-package.Rd man/unbranch.Rd man/pvclust_show_signif_gradient.Rd man/cutree_1k.dendrogram.Rd man/match_order_dendrogram_by_old_order.Rd man/intersect_trees.Rd man/cutree_1h.dendrogram.Rd man/prune.Rd man/color_labels.Rd man/DendSer.dendrogram.Rd man/Bk_plot.Rd man/circlize_dendrogram.Rd man/duplicate_leaf.Rd man/dendextend_labels.dendrogram.Rd man/get_branches_heights.Rd man/rect.dendrogram.Rd man/untangle.Rd man/has_component_in_attribute.Rd man/reexports.Rd man/remove_nodes_nodePar.Rd man/as.dendlist.Rd man/prune_leaf.Rd man/get_leaves_branches_attr.Rd man/rotate_DendSer.Rd man/cor_FM_index.Rd man/Bk.Rd man/cutree-methods.Rd man/cor_cophenetic.Rd man/get_leaves_attr.Rd man/count_terminal_nodes.Rd man/as_hclust_fixed.Rd man/sort_levels_values.Rd man/untangle_DendSer.Rd man/branches_attr_by_labels.Rd man/entanglement.Rd man/sort_dist_mat.Rd man/get_leaves_nodePar.Rd man/match_order_by_labels.Rd man/plot_horiz.dendrogram.Rd man/unclass_dend.Rd man/FM_index.Rd man/untangle_step_rotate_2side.Rd man/noded_with_condition.Rd man/d3dendro_options.Rd man/dend_diff.Rd man/all_unique.Rd man/order.dendrogram-assign.Rd man/na_locf.Rd man/assign_values_to_leaves_edgePar.Rd man/assign_values_to_leaves_nodePar.Rd man/dendextend_options.Rd man/Bk_permutations.Rd man/nnodes.Rd man/colored_bars.Rd man/is_null_list.Rd man/labels_cex.Rd man/get_leaves_branches_col.Rd man/ladderize.Rd man/cut_lower_fun.Rd man/find_k.Rd man/collapse_branch.Rd man/FM_index_R.Rd man/get_leaves_edgePar.Rd man/lowest_common_branch.Rd man/cor.dendlist.Rd man/common_subtrees_clusters.Rd man/bakers_gamma_for_2_k_matrix.Rd man/shuffle.Rd man/branches_attr_by_clusters.Rd man/set_labels.Rd

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.