ggtree
ggtree copied to clipboard
2D "Phylomorphospace" Plot Request
I would love to see a 2D "phylomorphospace" plotting feature in a future version of ggtree. I believe it would be really useful for many types of users to show scatter plots with a tree connecting the points.
There is already a nice simple package ggphylomorphospace that works great but it would be wonderful to integrate this with the other tidy data and plotting features of ggtree. :)
I second @jonnations ! ggphylomorphospace
is a bit limited because it requires a groupping variable.
I know this is a very old issue, but I came upon it late last year and finally got around to developping a new ggplot geom (geom_phylomorpho
) in my deeptime package for making 2D phylomorphospaces. My original plan was to allow both ggtree and normal ggplot usage, but that became untenable, so right now it uses the data in a normal ggplot call combined with a tree object that is included as an argument in the geom function.
library(ape)
tr <- rtree(10)
dat <- data.frame(x = runif(10), y = runif(10), label = tr$tip.label,
row.names = tr$tip.label)
gg <- ggplot(dat) +
geom_phylomorpho(tr, aes(x = x, y = y, label = label),
seg_args = list(color = "blue")) +
geom_label(aes(x = x, y = y, label = label), size = 5) +
theme_classic(base_size = 16)