I have a circular dendrogram in ggraph. Currently, each node's height is based on its distance from an end node with no children. This results in a continuous perimeter layer consisting of all the end nodes. Is there a way to control the layout so the height is rather based on distance from the central parent? In that case, C D E F would be the same distance from A as B, rather than on the outer perimeter.
library(tidyverse); library(tidygraph); library(ggraph)
nodes <- tibble(
staff = LETTERS[1:20],
num = 1:20
)
edges <- tibble(
reports_to_name = c(rep("A", 5), rep("B", 5), rep("G", 5), rep("M", 5)),
staff = nodes$staff
)
tbl_graph(nodes = nodes, edges = edges) %>%
ggraph(layout = 'dendrogram', circular = TRUE, repel = TRUE) +
geom_edge_arc(edge_width = 0.1, edge_alpha = 0.2) +
geom_node_text(aes(label = staff, hjust = "outward", angle = -((-node_angle(x,y)+90)%%180)+89)) +
theme_void()