pseudo-code:
ggtree <- function(..., layout = "xxx", ...) {
...
if {layout not defined in ggtree} {
p <- ggplot(..., layout = 'equal_angle')
convert tree to igraph object
apply layout to the object and extract node coordination
replace p$data$x and p$data$y with new coordination
}
....
}
In this way, we can mostly keep the ggtree package unchanged, while supporting graph layouts.
see also 3ee8a38.