dendrogram_data {ggalign}R Documentation

Dengrogram x and y coordinates

Description

Dengrogram x and y coordinates

Usage

dendrogram_data(
  tree,
  priority = "right",
  center = FALSE,
  type = "rectangle",
  leaf_pos = NULL,
  leaf_braches = NULL,
  branch_gap = NULL,
  root = NULL
)

Arguments

tree

A hclust or a dendrogram object.

priority

A string of "left" or "right". if we draw from right to left, the left will override the right, so we take the "left" as the priority. If we draw from left to right, the right will override the left, so we take the "right" as priority. This is used by align_dendro() to provide support of facet operation in ggplot2.

center

A boolean value. if TRUE, nodes are plotted centered with respect to the leaves in the branch. Otherwise (default), plot them in the middle of all direct child nodes.

type

A string indicates the plot type, "rectangle" or "triangle".

leaf_pos

The x-coordinates of the leaf node. Must be the same length of the number of observations in tree.

leaf_braches

Branches of the leaf node. Must be the same length of the number of observations in tree. Usually come from cutree.

branch_gap

A single numeric value indicates the gap between different branches.

root

A length one string or numeric indicates the root branch.

Value

A list of 2 data.frame. One for node coordinates, another for edge coordinates. node and tree segments edge coordinates contains following columns:

Examples

dendrogram_data(hclust(dist(USArrests), "ave"))

[Package ggalign version 0.0.3 Index]