Commit information:
Commit id: e73db7b44a8c7b26082d00a054884c208733d90d
angle for unrooted layout
Committed by: Guangchuang Yu
Author Name: Guangchuang Yu
Commit date: 2015-01-30 00:01:26 +0800
Author date: 2015-01-30 00:01:26 +0800
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@98849 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -156,11 +156,13 @@ layout.unrooted <- function(tree) { |
156 | 156 |
df$x <- NA |
157 | 157 |
df$y <- NA |
158 | 158 |
df$start <- NA |
159 |
- df$end <- NA |
|
159 |
+ df$end <- NA |
|
160 |
+ df$angle <- NA |
|
160 | 161 |
df[root, "x"] <- 0 |
161 | 162 |
df[root, "y"] <- 0 |
162 |
- df[root, "start"] <- 0 |
|
163 |
- df[root, "end"] <- 2 |
|
163 |
+ df[root, "start"] <- -1 |
|
164 |
+ df[root, "end"] <- 1 |
|
165 |
+ df[root, "angle"] <- 0 |
|
164 | 166 |
|
165 | 167 |
nb.sp <- sapply(1:N, function(i) length(get.offspring.tip(tree, i))) |
166 | 168 |
|
... | ... |
@@ -188,6 +190,7 @@ layout.unrooted <- function(tree) { |
188 | 190 |
length.child <- df[child, "length"] |
189 | 191 |
df[child, "x"] <- df[curNode, "x"] + cospi(beta) * length.child |
190 | 192 |
df[child, "y"] <- df[curNode, "y"] + sinpi(beta) * length.child |
193 |
+ df[child, "angle"] <- -180 * abs(beta) |
|
191 | 194 |
df[child, "start"] <- start |
192 | 195 |
df[child, "end"] <- start + alpha |
193 | 196 |
start <- start + alpha |