Skip to contents

[Stable]

This function converts various objects to a data frame.

Usage

# S3 method for class 'phylo'
fortify_data_frame(
  data,
  ...,
  type = "rectangle",
  center = FALSE,
  tree_type = NULL,
  tip_pos = NULL,
  data_arg = caller_arg(data),
  call = NULL
)

Arguments

data

A hclust or a dendrogram object.

...

These dots are for future extensions and must be empty.

type

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

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.

tree_type

A single string, one of "phylogram" or "cladogram", indicating the type of tree.

  • phylogram: Represents a phylogenetic tree where branch lengths indicate evolutionary distance or time.

  • cladogram: Represents a tree where branch lengths are not used, or the branches do not reflect evolutionary time.

Usually, you don't need to modify this.

tip_pos

The x-coordinates of the tip. Must be the same length of the number of tips in tree.

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, e.g., caller_env(). Developers can use it to improve messages. Not used by the user.

Value

A data frame with the node coordinates:

  • .index: the original index in the tree for the the tip/node.

  • label: the tip/node label text.

  • x and y: x-axis and y-axis coordinates for the tip/node.

  • tip: A logical value indicates whether current node is a tip.

ggalign attributes

edge: A data frame for edge coordinates:

  • x and y: x-axis and y-axis coordinates for the start node of the edge.

  • xend and yend: the x-axis and y-axis coordinates of the terminal node for edge.