I have one phylogenetic tree as picture below.
I did make a fake dataframe to get the legend, and now I would like to insert that legend to the center of phylogenetic tree. I used grid.arrange
but I could not move the legend position.
The fake legend that I created
df <- data.frame(name = c("ANA-GRADE", "ASTERIDS","BASAL EUDICOTS", "BASAL SUPERASTERIDS",
"CHOLORANTHALES", "MAGNOLIIDS", "MONOCOTS","ROSIDS",
"ANA-GRADE", "ASTERIDS","BASAL EUDICOTS", "BASAL SUPERASTERIDS",
"CHOLORANTHALES", "MAGNOLIIDS", "MONOCOTS","ROSIDS"),
colour = c("#EFF13A", "#428d34", "#84cf70", "#62a852", "#CDD100",
"#8B5742", "#EEAD0E", "#2d7a21", "#EFF13A", "#428d34",
"#84cf70", "#62a852", "#CDD100", "#8B5742", "#EEAD0E", "#2d7a21"),
x1 = runif(16, 5,100),
y1 = runif(16, 20,50))
fake <- df %>% ggplot(aes(x1,y1, colour = name)) +
geom_line(size = 1) +
scale_colour_manual(values = c("#EFF13A", "#428d34", "#84cf70", "#62a852", "#CDD100",
"#8B5742", "#EEAD0E", "#2d7a21"),
name = "Major clade") +
theme_bw() +
theme(legend.title = element_text(face = "bold",size = 12))
legend <- get_legend(fake)
# using grid.arrange
Does anyone has suggestion for me using grid.arrange
?