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

ggdensitree + revts #437

Open
thijsjanzen opened this issue Sep 22, 2021 · 2 comments
Open

ggdensitree + revts #437

thijsjanzen opened this issue Sep 22, 2021 · 2 comments

Comments

@thijsjanzen
Copy link

I would like to make a plot as hinted here: #87
e.g. a densitree with a timescale with 0 at the tips, and -crown_age at the root.

However, the following code does not work as expected, and only reverts one of the two tree plots.

trees <- list()
trees[[1]] <- rtree(n = 10)
trees[[2]] <- rtree(n = 10)
class(trees) <- "multiPhylo"
p <- ggdensitree(trees) + theme_tree2()
p2 <- revts(p)
multiplot(p, p2, ncol=2)
@brj1
Copy link
Contributor

brj1 commented Sep 26, 2021

I have built a workaround for this in 5a70208. ggdensitree will set the maximum tip date to 0 when align.tips = TRUE (the default). So,

trees <- list()
trees[[1]] <- rtree(n = 10)
trees[[2]] <- rtree(n = 10)
class(trees) <- "multiPhylo"
p <- ggdensitree(trees) + theme_tree2()
p

will produce the plot you want, with no revts required.

ggtree2

@thijsjanzen
Copy link
Author

Works like a charm! Also, works for all densitrees

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