Node pie diameters and tree branch weight

548 views
Skip to first unread message

Mykle Hoban

unread,
Dec 13, 2016, 8:18:22 PM12/13/16
to ggtree
Howdy-

I did quite a bit of googling and didn't come up with anything, so I apologize if this has been answered elsewhere. I have two questions:

1. Is there a way to modify the size of the pie charts plotted using nodepie?

2. Is there a way to specify the thickness (line weight) of tree branches? In particular, I'd like to be able to specify the thickness based on an annotation value.

Thanks!

gc...@connect.hku.hk

unread,
Dec 13, 2016, 11:16:50 PM12/13/16
to ggtree
1. you can pass width and height to inset() function.
2. just use ggtree(aes(size=VAR)).

Mykle Hoban

unread,
Dec 14, 2016, 5:39:09 PM12/14/16
to ggtree
Thanks for the reply. That got me part of the way there.

Passing width and height to inset() worked, but I don't quite understand the scale of the width/height values. Width=1 and height=1 gives me pies that are roughly half the width of the plotting window in diameter. 

On that same topic, when I pass aes(size=VAR) to ggtree, it works, but the line weights are WAY too big. My variable ranges from 0 to 1, yet the minimum thickness is still giant. I tried passing size=1, and the lines are quite thick. For some reason, manually passing anything less than 1 to size (e.g. size=0.1) doesn't make it any smaller than the size generated by size=1. 

It looks like I just don't get what scales / values are being used by the height, width, and size parameters. I apologize again if this is somewhere in the documentation, but I haven't been able to dig it up.

Thanks again!

Yu, Guangchuang

unread,
Dec 14, 2016, 10:07:34 PM12/14/16
to Mykle Hoban, ggtree
On Thu, Dec 15, 2016 at 6:39 AM, Mykle Hoban <dead...@gmail.com> wrote:
Thanks for the reply. That got me part of the way there.

Passing width and height to inset() worked, but I don't quite understand the scale of the width/height values. Width=1 and height=1 gives me pies that are roughly half the width of the plotting window in diameter. 


yes, width=1 and height=1 will set the diameter to half of the window. Then the pie will take the whole window to plot.
 
On that same topic, when I pass aes(size=VAR) to ggtree, it works, but the line weights are WAY too big. My variable ranges from 0 to 1, yet the minimum thickness is still giant. I tried passing size=1, and the lines are quite thick. For some reason, manually passing anything less than 1 to size (e.g. size=0.1) doesn't make it any smaller than the size generated by size=1. 


If you want to map size to the exact value of VAR, you need to use aes(size=I(VAR)). This is documented somewhere in ggplot2's manual and book.

 
It looks like I just don't get what scales / values are being used by the height, width, and size parameters. I apologize again if this is somewhere in the documentation, but I haven't been able to dig it up.

Thanks again!


On Tuesday, December 13, 2016 at 6:16:50 PM UTC-10, gc...@connect.hku.hk wrote:
1. you can pass width and height to inset() function.
2. just use ggtree(aes(size=VAR)).



On Wednesday, December 14, 2016 at 9:18:22 AM UTC+8, Mykle Hoban wrote:
Howdy-

I did quite a bit of googling and didn't come up with anything, so I apologize if this has been answered elsewhere. I have two questions:

1. Is there a way to modify the size of the pie charts plotted using nodepie?

2. Is there a way to specify the thickness (line weight) of tree branches? In particular, I'd like to be able to specify the thickness based on an annotation value.

Thanks!

--
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.
To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/05ac1fbe-b657-4e17-a7c1-5bae16d5125b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu, PhD Candidate
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
-~----------~----~----~----~------~----~------~--~---

JUN YE

unread,
Jun 22, 2017, 12:42:11 AM6/22/17
to ggtree
As for the line weight, instead of "ggtree(aes(size=VAR))", this works for me "ggtree(tree, size=0.1)"

在 2016年12月15日星期四 UTC+10上午8:39:09,Mykle Hoban写道:

lichenhao.sg

unread,
Oct 24, 2018, 3:36:02 AM10/24/18
to ggtree
Following this thread, is there a way to map the diameter of the pie charts to some variable?

Chenhao.

On Thursday, December 15, 2016 at 11:07:34 AM UTC+8, Yu, Guangchuang wrote:
On Thu, Dec 15, 2016 at 6:39 AM, Mykle Hoban <dead...@gmail.com> wrote:
Thanks for the reply. That got me part of the way there.

Passing width and height to inset() worked, but I don't quite understand the scale of the width/height values. Width=1 and height=1 gives me pies that are roughly half the width of the plotting window in diameter. 


yes, width=1 and height=1 will set the diameter to half of the window. Then the pie will take the whole window to plot.
 
On that same topic, when I pass aes(size=VAR) to ggtree, it works, but the line weights are WAY too big. My variable ranges from 0 to 1, yet the minimum thickness is still giant. I tried passing size=1, and the lines are quite thick. For some reason, manually passing anything less than 1 to size (e.g. size=0.1) doesn't make it any smaller than the size generated by size=1. 


If you want to map size to the exact value of VAR, you need to use aes(size=I(VAR)). This is documented somewhere in ggplot2's manual and book.

 
It looks like I just don't get what scales / values are being used by the height, width, and size parameters. I apologize again if this is somewhere in the documentation, but I haven't been able to dig it up.

Thanks again!


On Tuesday, December 13, 2016 at 6:16:50 PM UTC-10, gc...@connect.hku.hk wrote:
1. you can pass width and height to inset() function.
2. just use ggtree(aes(size=VAR)).



On Wednesday, December 14, 2016 at 9:18:22 AM UTC+8, Mykle Hoban wrote:
Howdy-

I did quite a bit of googling and didn't come up with anything, so I apologize if this has been answered elsewhere. I have two questions:

1. Is there a way to modify the size of the pie charts plotted using nodepie?

2. Is there a way to specify the thickness (line weight) of tree branches? In particular, I'd like to be able to specify the thickness based on an annotation value.

Thanks!

--
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages