fortify_data_frame.dendrogram {ggalign}R Documentation

Build a data frame

Description

[Stable]

This function converts various objects to a data frame.

Usage

## S3 method for class 'dendrogram'
fortify_data_frame(
  data,
  ...,
  priority = "right",
  center = FALSE,
  type = "rectangle",
  leaf_pos = NULL,
  leaf_braches = NULL,
  reorder_branches = TRUE,
  branch_gap = NULL,
  root = NULL,
  double = TRUE,
  data_arg = NULL,
  call = NULL
)

## S3 method for class 'hclust'
fortify_data_frame(data, ...)

Arguments

data

A hclust or a dendrogram object.

...

Additional arguments passed to dendrogram method.

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 all leaves/tips in the branch. Otherwise (default), plot them in the middle of the 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.

reorder_branches

A single boolean value, indicates whether reorder the provided leaf_braches based on the actual index.

branch_gap

A single numeric value indicates the gap between different branches.

root

A length one string or numeric indicates the root branch.

double

A single logical value indicating whether horizontal lines should be doubled when segments span multiple branches. If TRUE, the horizontal lines will be repeated for each branch that the segment spans. If FALSE, only one horizontal line will be drawn. This is used by align_dendro() to provide support of facet operation in ggplot2.

data_arg

The argument name for data. Developers can use it to improve messages. Not used by the user.

call

The execution environment where data and other arguments for the method are collected. Developers can use it to improve messages. Not used by the user.

Value

A ⁠data frame⁠ with the node coordinates:

ggalign attributes

edge: A ⁠data frame⁠ for edge coordinates:

See Also

Other fortify_data_frame() methods: fortify_data_frame.character(), fortify_data_frame.default(), fortify_data_frame.matrix(), fortify_data_frame.phylo()

Examples

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

[Package ggalign version 1.0.2 Index]