1
$\begingroup$

I'm editing a time-scaled tree using ggtree. The dates are correctly adjusted when I apply the 'mrsd' command and 'theme_tree2()', but when I try to rotate the tree with 'layout_dendrogram()', the scale still remains on the x-axis with no dates. Is there a way to place the date scale on the y-axis in a tree rotated with 'layout_dendrogram()'?

# Code without layout_dendrogram()
ggtree(my_tree, mrsd='2022-12-31') %<+% 
  metadato_arbol + 
  geom_tippoint(size = 2) + 
  theme_tree2()

enter image description here

# Using layout_dendrogram()
ggtree(my_tree, mrsd='2022-12-31') %<+% 
  metadato_arbol + 
  geom_tippoint(size = 2) + 
  theme_tree2() + layout_dendrogram()

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Without a minimal reproducible example this is only a guess, but try substituting theme_dendrogram() for theme_tree2() and see you still get the same output. $\endgroup$ Commented Aug 25, 2023 at 1:05

1 Answer 1

0
$\begingroup$

Maybe try the following via gridExtra,

library(gridExtra)
library(ggtree)
library(ape)
set.seed(2023-08-23)
my_tree <- rtree(30)
p <- ggtree(my_tree, mrsd='2022-12-31') %<+% 
  metadato_arbol + 
  geom_tippoint(size = 2) + 
  theme_tree2() # + geom_text(aes(label=node))
gridExtra::grid.arrange(p, p %>% rotate(33) %>% rotate(52), ncol=2)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.