Skip to contents

Cluster trees preserve the leaf order and merge heights in the object. Phylogenies use distance along the edges from the displayed root. The fan layout maps that distance to radius. If branch lengths are absent each edge counts as one step. The optional stem above the root is excluded.

Usage

# S3 method for class 'hclust'
hchart(object, ...)

# S3 method for class 'dendrogram'
hchart(object, ...)

# S3 method for class 'phylo'
hchart(object, ..., layout = c("fan", "rectangular"))

Arguments

object

An hclust, dendrogram, or ape::phylo object.

...

Highcharts treegraph series options for cluster trees, or line options for phylogeny branches.

layout

For a phylogeny, "fan" (radial) or "rectangular".

Value

A highchart htmlwidget.

Details

Cluster dendrograms use rectangular branches with square corners to show each join at its merge height. The treegraph defaults for these methods are link = list(type = "orthogonal", bendAt = 0, radius = 0). Use hchart(fit, link = list(type = "straight")) for triangular branches or type = "curved" inside link to restore the native curved treegraph style.

Examples

data("bird.families", package = "ape")
families <- c(
  "Rheidae", "Casuariidae", "Struthionidae", "Phasianidae", "Numididae",
  "Odontophoridae", "Anhimidae", "Dendrocygnidae", "Anatidae"
)
birds <- ape::keep.tip(bird.families, families)
hchart(stats::as.hclust(birds))
hchart(birds)