Closed brj1 closed 3 years ago
it seems there is no change in the https://github.com/YuLab-SMU/ggtree/issues/437 plot.
My PR does not fix revts
for ggdensitree
plots. Instead it makes the the x-axis, 0, at the rightmost maximum tip, essentially incorpating revts
into ggdensitree
. It only does this when align.tips = TRUE
. If align.tips = FALSE
, then x=0
is at the root.
Compare the following code on 5d2d10d4a5b99404c85fd4bb97e2f6948e13c64b and 5ad1c432aa554dd2e2b853d3eaa76366b16b3b8b
trees <- list()
trees[[1]] <- rtree(n = 10)
trees[[2]] <- rtree(n = 10)
class(trees) <- "multiPhylo"
ggdensitree(trees) + theme_tree2()
5d2d10d4a5b99404c85fd4bb97e2f6948e13c64b
5ad1c432aa554dd2e2b853d3eaa76366b16b3b8
EDIT: Sorry I forgot to set the same seed for the random trees, in the two runs. But the important thing is to look at the axes.
Hi Dr. Yu,
In response to #437, I thought that it might be better for
ggdensitree
to set the maximum x value to 0 when you align tips instead of the default value which is the height of the tallest tree. With this changewould appear as if you ran
revts
on the plot. I think this works better because many of times that people will want to useggdensitree
, they will want to indicate time in the past. And if they want to indicate calendar dates it is easier to work from the tip dates than from a root which may have an arbitrary date.As an aside, I think that the
revts
function might need to be reworked, since it doesn't really follow theggplot
philosophy. Maybe you could turn it into a scale?