# Visualizing Astronomical Dendrograms¶

You can use Glue to visualize dendrograms created by the astrodendro package.

## Enabling the viewer¶

The dendrogram viewer will be automatically available if the astrodendro package is installed. To install it, simply use:

pip install astrodendro


## Building a dendrogram¶

The details of constructing dendrograms for astronomical images is beyond the scope of this document – see https://dendrograms.readthedocs.io/ for more information. The following snippet builds a dendrogram from the W5 image used in the tutorial:

from astropy.io import fits
from astrodendro import Dendrogram

data = fits.getdata('W5.fits')
dg = Dendrogram.compute(data, min_value=500, min_npix=50)
dg.save_to('w5_dendro.fits')


Next, load this file into Glue, choosing “Dendrogram” as a file type. You can now visualize the W5 dendrogram alongside its image: