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

Phylogeny side by side with the arcdiagram? #3

Open
daijiang opened this issue May 28, 2014 · 2 comments
Open

Phylogeny side by side with the arcdiagram? #3

daijiang opened this issue May 28, 2014 · 2 comments

Comments

@daijiang
Copy link

Hi Gaston,
Thanks for this nice package!

Suppose nodes in the arcdiagram are species and we have a phylogeny for these species. I wonder how hard it is to plot the phylogeny under the nodes if horizontal = TRUE and side by side if horizontal =FALSE? By doing this, we can have both the interaction information and their evolutionary history in the same plot. It will be great feature to have.

For plotting the phylogeny, I am using plot.phylo() function in the picante package. But I did not figure out a way to align the phylo plot and the arcdiagram.

Thanks!
Daijiang

@holmrenser
Copy link
Contributor

I am actually doing the same thing. I managed to plot phylogeny and arcdiagram side-by-side, but it would be nicer if we were able to specify xlim and ylim in the arcplot function.

@jmpowers
Copy link

jmpowers commented Dec 19, 2023

This was fixed by @holmrenser with pull request #4

You can now set ylim to the coordinates of the top and bottom nodes (when vertical) to match the y coordinates of a phylogenetic tree:

ntaxa <- 10
pairtree <- ape::rtree(ntaxa)
par(mfrow = c(1, 2))
ape::plot.phylo(pairtree, align.tip.label = TRUE)
arcdiagram::arcplot(edgelist = matrix(paste0("t", 1:ntaxa), ncol = 2, byrow = TRUE),
                    show.labels = FALSE, horizontal = FALSE, ordering = pairtree$tip.label,
                    ylim = range(arcdiagram::xynodes(ntaxa, 1:ntaxa, labels = 1:ntaxa)))

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

3 participants