Is there a way to plot dendrogram?



Hierarchical clustering is quite simple in Julia by using hclust() in the Clustering package,
but plotting the result in Julia does not seem to be straightforward for me as in Python.

Grateful to any suggestion from you.


Not that I know of - but this would be an excellent contribution to a package like PlotRecipes, or as a plotting recipe in Clustering itself if they are happy to have it there.


PlotRecipes already has recipes for plotting graph-like objects - it may be possible to create a plot recipe that uses this existing functionality.


You might want to look at There’s an example in the Plots docs:

Even if this doesn’t directly solve your problem, you might be able to get ideas from it.


I often do my computation in Julia but then use the PyCall package to call a mature Python visualization routine on that data. PyCall is really easy to use.



using PyCall
using PyPlot
@pyimport scipy.cluster.hierarchy as hierarchy
hierarchy.dendrogram([0 1 .7 2])


The linkage function in Scipy follows MATLAB-style output while hclust() in Clustering.jl follows R-style one.

Since MATLAB-style output is more compatible in both suggestions above, I hope that the hclust() in Clustering.jl will be revised sometime (Sorry if the JuliaStat Project favors R-Style). Changing the output format itself is not difficult but a bit bothering for someone :slight_smile:


Kescobo have a nice implementation, just was not merged. It works directly with Hclust type.