# Pass Clustering.Hclust to Makie.dendrogram

**URL:** https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143
**Category:** General Usage
**Tags:** clustering, makie, dendrogram
**Created:** [January 19, 2026, 3:50pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143 "2026-01-19T15:50:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![alequa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alequa/32/12338_2.png) [@alequa](https://discourse.julialang.org/u/alequa)
#### Post date: [January 19, 2026, 3:50pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143/1 "2026-01-19T15:50:39Z")

</div>

Hello,

I would like to know how to convert the [HClust object](https://juliastats.org/Clustering.jl/stable/hclust.html#Clustering.Hclust) to a data format that can be processed by the [dendrogram recipe](https://docs.makie.org/dev/reference/plots/dendrogram) for Makie.

There is a quite long [pull-request history](https://github.com/MakieOrg/Makie.jl/pull/2755) for the `dendrogram` recipe, and it seems it was in the initial design to have compatibility with Clustering.jl, but then it s not clear how to do it…

Maybe @kescobo knows 🙂  
Thanks!

---

<div class="post-metadata">

### Author: ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)
#### Post date: [January 19, 2026, 8:44pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143/2 "2026-01-19T20:44:44Z")

</div>

I do! But will need to review to be 100% certain. I can look again later this week, but the short version is that the hclust object has a “merges” property, which is an ordered list of tuples of integers. Each merge represents a node.

The integers inside merges either represent a leaf (negative numbers) or a previous intersection (positive numbers).

In the makie recipe, you have leaves and intersections, but off the top of my head I don’t remember how they relate… I think there’s an example somewhere in one of the issues, but I’ll dig through and try to PR with a package extension this week

---

<div class="post-metadata">

### Author: ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)
#### Post date: [January 20, 2026, 9:17pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143/3 "2026-01-20T21:17:12Z")

</div>

it’s something like:

```julia-auto
hcl = hclust(...)
nodes = Makie.hcl_nodes(hcl) # this is an undocumented internal function
dendrogram(nodes)

```

---

<div class="post-metadata">

### Author: ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)
#### Post date: [January 21, 2026, 9:52pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143/4 "2026-01-21T21:52:11Z")

</div>

Ah yes, I think @ffreyer added that from my example code in the initial PR (see [https://github.com/MakieOrg/Makie.jl/pull/2755#discussion\_r2091628231](https://github.com/MakieOrg/Makie.jl/pull/2755#discussion_r2091628231)).

I see there that I offered to make a PR there nearly a year ago 🤦

---

<div class="post-metadata">

### Author: ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)
#### Post date: [January 22, 2026, 5:34pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143/5 "2026-01-22T17:34:14Z")

</div>

> <https://github.com/MakieOrg/Makie.jl/pull/5508>
>
> \# Description
> 
> Extends #2755 to add a package extension for the Clustering.jl …\`HClust\` type. Draft still because I wasn't sure how (or if I should) add the \`useheight\` parameter to enable usage of the heights in the \`HClust\`. 
> 
> \## Type of change
> 
> \- \[x\] New feature (non-breaking change which adds functionality)
> 
> \## Checklist
> 
> \- \[\] Added an entry in CHANGELOG.md (for new features and breaking changes)
> \- \[x\] Added or changed relevant sections in the documentation
> \- \[\] Added unit tests for new algorithms, conversion methods, etc.
> \- \[\] Added reference image tests for new plotting functions, recipes, visual options, etc.
