This page aims to describe how to make a basic dendrogram representing hierarchical data with the ggraph library. Two input formats are considered: edge list and nested data frame. Please visit this page to learn how to custom these dendrograms. If you want to create a dendrogram from clustering result, visit the dendrogram section of the gallery.


From edge list

Edge list is the most convenient format to use ggraph. You just have to transform it to a graph object using a function from the igraph library and you’re ready to use the dendrogram layout of ggraph.


From nested data frame.

Another common format is the nested data frame. The code below shows how to easily transform it into a nested data frame. Once it is done, just apply the code described above once more.


If you’ve read until here, you’re now ready to custom your dendrogram.