RHGCPlotDendrogram: Visualizing the dendrogram

Description Usage Arguments Details Value Examples

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

XuegongLab/HGC documentation built on Dec. 18, 2021, 7:23 p.m.