grid.dendrogram: Draw the Dendrogram

Description Usage Arguments Details Examples

View source: R/grid.dendrogram.R

Description

Draw the Dendrogram

Usage

1
grid.dendrogram(dend, ..., test = FALSE)

Arguments

dend

A dendrogram object.

...

Pass to dendrogramGrob.

test

Is it in test mode? If it is in test mode, a viewport is created by calculating proper xlim and ylim.

Details

grid.dendrogram supports drawing dendrograms with self-defind leaf positions. The positions of leaves can be defined by adjust_dend_by_x. Also the dendrogram can be customized by setting the edgePar attribute for each node (basically for controlling the style of segments), e.g. by color_branches.

To draw the dendrogram, a viewport should be firstly created. dend_xy can be used to get the positions of leaves and height of the dendrogram.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
m = matrix(rnorm(100), 10)
dend = as.dendrogram(hclust(dist(m)))
grid.newpage()
pushViewport(viewport(xscale = c(0, 10.5), yscale = c(0, dend_heights(dend)), 
    width = 0.9, height = 0.9))
grid.dendrogram(dend)
popViewport()

grid.dendrogram(dend, test = TRUE)

require(dendextend)
dend = color_branches(dend, k = 2)
dend = adjust_dend_by_x(dend, unit(sort(runif(10)*10), "cm"))
grid.dendrogram(dend, test = TRUE)

Example output

Loading required package: grid
========================================
ComplexHeatmap version 2.6.2
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

Loading required package: dendextend

---------------------
Welcome to dendextend version 1.14.0
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package:dendextendThe following object is masked frompackage:stats:

    cutree

ComplexHeatmap documentation built on Nov. 14, 2020, 2:01 a.m.