R: Apply a dendrogram layout to layout_tbl_graph

layout_tbl_graph_dendrogram {ggraph} | R Documentation

## Apply a dendrogram layout to layout_tbl_graph

### Description

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.

### Usage

    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()`

### See Also

Other layout_tbl_graph_*: `layout_tbl_graph_auto`, `layout_tbl_graph_backbone`, `layout_tbl_graph_centrality`, `layout_tbl_graph_circlepack`, `layout_tbl_graph_eigen`, `layout_tbl_graph_fabric`, `layout_tbl_graph_focus`, `layout_tbl_graph_hive`, `layout_tbl_graph_igraph`, `layout_tbl_graph_linear`, `layout_tbl_graph_manual`, `layout_tbl_graph_matrix`, `layout_tbl_graph_partition`, `layout_tbl_graph_pmds`, `layout_tbl_graph_stress`, `layout_tbl_graph_treemap`, `layout_tbl_graph_unrooted`

[Package ggraph version 2.0.0 Index]