ggtree
ggtree copied to clipboard
What is a transformation that is being done for layout="circle"?
I am trying to add an additional layer to tree
tree=rtree(10)
ggtree(tree, layout="circular")
I need my additional layer to contain 10 points aligned horizontally ( ina straight line)
v <- data.frame( z = 3, j= c(3.2, 3.2+1, 3.2+2, 3.2+3))
ggtree(tree, layout="circular")+geom_point(data=v, aes(x=z, y=j), color="green")
I can't seem to figure out what transformation been done to get my points to display in a linear fashion.
I guess you want this.
library(ggtree)
library(ggtreeExtra)
library(ggplot2)
set.seed(1024)
tree <- rtree(10)
#p <- ggtree(tree, layout="circular")
tree$tip.label
v <- data.frame(z = c(rep("t5",4), rep("t8",4), rep("t6", 4)), j= c(rep(c(3.2, 3.2+1, 3.2+2, 3.2+3),3)))
v
p <- ggtree(tree)+
geom_tiplab()+
geom_fruit(data=v,
geom=geom_point,
mapping=aes(y=z, x=j),
pwidth=0.4,
color="green")
or
p <- ggtree(tree, layout="fan", open.angle=195)+
geom_tiplab()+
geom_fruit(data=v,
geom=geom_point,
mapping=aes(y=z, x=j),
pwidth=0.4,
color="green")
geom_fruit
is a function from ggtreeExtra