Skip to content

Commit

Permalink
Merge pull request #129 from KlausVigo/master
Browse files Browse the repository at this point in the history
Make number of segments dependent on the angle
  • Loading branch information
emmanuelparadis authored Sep 23, 2024
2 parents 6d4fb54 + 84362b8 commit 65d7cea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/plot.phylo.R
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,12 @@ circular.plot <- function(edge, Ntip, Nnode, xx, yy, theta,
for (k in 1:Nnode) {
i <- start[k]
j <- end[k]
X <- rep(r[edge[i, 1]], 100)
Y <- seq(theta[edge[i, 2]], theta[edge[j, 2]], length.out = 100)
# make number of segments dependent on the angle
n_segments <- as.integer(2 + (theta[edge[j, 2]] - theta[edge[i, 2]]) / 0.03)
X <- rep(r[edge[i, 1]], n_segments)
Y <- seq(theta[edge[i, 2]], theta[edge[j, 2]], length.out = n_segments)
x <- X * cos(Y); y <- X * sin(Y)
x0 <- x[-100]; y0 <- y[-100]; x1 <- x[-1]; y1 <- y[-1]
x0 <- x[-n_segments]; y0 <- y[-n_segments]; x1 <- x[-1]; y1 <- y[-1]
segments(x0, y0, x1, y1, col = co[[k]], lwd = lw[[k]], lty = ly[[k]])
}
}
Expand Down

0 comments on commit 65d7cea

Please sign in to comment.