I want to know how to get the node coordinates of the deformed ggtree. The coordinates obtained by ggtree::fortify() are valid in a square tree, but I don't know how to get coordinates for other tree points with shapes such as circular or slanted. I guess it's going to take some polar conversion. Here is my code to make tree:
I want to know how to get the node coordinates of the deformed ggtree. The coordinates obtained by ggtree::fortify() are valid in a square tree, but I don't know how to get coordinates for other tree points with shapes such as circular or slanted. I guess it's going to take some polar conversion. Here is my code to make tree:
The fortified data is not consistent with the plane cartesian coordinates of the points on the fan-shaped graph.
I tried to parse the ggplot object directly, using
ggplot2::ggplot_build()
Here is my code:ggplot2::ggplot_build(a)[["data"]][[2]]
The output is, take node t6 (node 1 , parent11) as example:
But t6 is definitely not anywhere near (0,2.95) or (0,1). The expected coorinate is more like the middle of the plot. I really need help, please.