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

Aligning tree with other ggplot2 #29

Closed
stiatragul opened this issue Nov 28, 2015 · 7 comments
Closed

Aligning tree with other ggplot2 #29

stiatragul opened this issue Nov 28, 2015 · 7 comments

Comments

@stiatragul
Copy link

Hi Guangchuang Yu,

First of all thank you for your ggtree package, it is truly versatile and really takes advantage of the good stuff from ggplot2!

I am currently preparing a figure for publication about trait variation and evolution across fiddler crab species. My goal is to have a figure that looks like this: http://ape-package.ird.fr/image/Figure2_TEJEDO.png (Richter-Boix A., Tejedo M. & Rezende E. L. 2011).

Attempt: (attached)
I created a dendogram using ggtree and a ggplot of trait (size) vs species (order). The species name is at the tip of the dendogram. I used ggExtra to arrange them in such a way. While it looks ok, the alignment is not proper.

Request:
Is there a way to align a ggplot like this one with each taxa from ggtree? This will be similar to what has been done with the gheatmap, if we can somehow make the dendogram the x-axis of the ggplot, that would be awesome!

Thank you so much in advance!
Putter

Picture:
gridetraarrange

@GuangchuangYu
Copy link
Member

same issue as in issue 3, gridExtra can not arrange them properly. This is the reason why I need to develop gheatmap function.

@stiatragul
Copy link
Author

The gheatmap function is great for aligning a 'data' with the tree. However, my graph is a ggplot so the gheatmap function does not recognize it. In issue 3, the problem seemed to be aligning a "heatmap."

I hope this helps and that this is not just me being incapable of writing the code correctly. I looked at the vignette many times but could not figure it out. Please advise how I could use the gheatmap function to align my ggplot with my tree.

Thank you for your patience! I appreciate your time in helping me out!

@GuangchuangYu
Copy link
Member

In issue 3, the issue is using grid.arrange can't align a ggplot object (heatmap) with a tree.

AND gheatmap is designed to align heatmap with a tree. It can't work with a ggplot object.

@stiatragul
Copy link
Author

I see, thank you very much again for your response. I saw a request for ggplot2 two to develop a function that will do just that. I hope this development will happen in the near future.

@GuangchuangYu
Copy link
Member

I think gtable can help. I will look into it when I have some free time.

It would be great if we can work out a way more general than gheatmap.

@stiatragul
Copy link
Author

Thanks so much, I will look into using gtable but a lot of learning has to take place on my part first. I agree, it would be great to get a more general function because these sort of figure are helpful!

@GuangchuangYu
Copy link
Member

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