Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale on the y-axis in a tree rotated with 'layout_dendrogram()' #584

Open
gvaleman opened this issue Aug 22, 2023 · 1 comment
Open

Scale on the y-axis in a tree rotated with 'layout_dendrogram()' #584

gvaleman opened this issue Aug 22, 2023 · 1 comment

Comments

@gvaleman
Copy link

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()

image

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

image

@SamPassmore
Copy link

I have the same problem (in #598).

This is my current workaround:

library(ape)
library(ggtree)
library(ggplot2)

n = 50
t = rcoal(n)

ggtree(t) + 
  layout_dendrogram() +
  theme(axis.ticks.y = element_line(),
        axis.line.y = element_line(),
        axis.text.y = element_text())

Although it doesn't seem to allow custom tip labels(e.g. 20k instead to 20000), for a reason I cannot figure out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants