This layout mimics the igraph::layout_as_tree() algorithm supplied by igraph, but puts all leaves at 0 and builds it up from there, instead of starting from the root and building it from there. The height of branch points are related to the maximum distance to an edge from the branch node, or read from a node variable.

layout_tbl_graph_dendrogram(
  graph,
  circular = FALSE,
  offset = pi/2,
  height = NULL,
  length = NULL,
  repel = FALSE,
  ratio = 1,
  direction = "out"
)

Arguments

graph

A tbl_graph object

circular

Logical. Should the layout be transformed to a circular representation. Defaults to FALSE.

offset

If circular = TRUE, where should it begin. Defaults to pi/2 which is equivalent to 12 o'clock.

height

The node variable holding the height of each node in the dendrogram. If NULL it will be calculated as the maximal distance to a leaf.

length

An edge parameter giving the length of each edge. The node height will be calculated from the maximal length to the root node (ignored if height does not evaluate to NULL)

repel

Should leafs repel each other relative to the height of their common ancestor. Will emphasize clusters

ratio

The strength of repulsion if repel = TRUE. Higher values will give more defined clusters

direction

The direction to the leaves. Defaults to 'out'

Value

A data.frame with the columns x, y, circular, depth and leaf as well as any information stored as node variables on the tbl_graph

Note

This function is not intended to be used directly but by setting layout = 'dendrogram' in create_layout()