HGC.PlotDendrogram {HGC} | R Documentation

## Visualizing the dendrogram

### Description

The function will plot the dendrogram, with different colors for different clusters.

### Usage

    HGC.PlotDendrogram(tree, k, plot.label, labels)

### Arguments

`tree` | the input clustering tree saved as `hclust` data structure.
`k` | the number of clusters to cut the tree into.
`plot.label` | a bool variable. It decides whether the function will add color bars.
`labels` | a data frame or a matrix to store the label information. Different labels should be in different columns and the users should name the columns correspondingly. The label information will show in the figure as color bars below the dendrogram, and each label takes one color bar.

### Details

The function plots the clustering tree, with alternative colors showing the clustering results and the label information. It is based on the R package `dendextend` which contains many parameters for the visualization. For users' convenience, most of the parameters are set to be the default value. Advanced users could visit the vignette of `dendextend` for more flexible visualization.

### Value

The function will return 1 if the dendrogram is successfully drawn.

### Examples

    data(Pollen)
    Pollen.PCs <- Pollen[["PCs"]]
    Pollen.Label.Tissue <- Pollen[["Tissue"]]
    Pollen.Label.CellLine <- Pollen[["CellLine"]]

    Pollen.SNN <- SNN.Construction(Pollen.PCs)
    Pollen.ClusteringTree <- HGC.dendrogram(G = Pollen.SNN)
    Pollen.labels <- data.frame(Tissue = Pollen.Label.Tissue,
                                CellLine = Pollen.Label.CellLine)
    HGC.PlotDendrogram(tree = Pollen.ClusteringTree,
                        k = 5, plot.label = TRUE,
                        labels = Pollen.labels)

[Package HGC version 1.2.0 Index]