It may also be worth mentioning that the source of the bug appears to be
that edge labels were plotted halfway between the end of the edge & the
location of the end of the parent edge - but this does not work for fan
style trees, except for edges arising out of the root.
Also of note is that the argument "edge" gives the indices of each edge
in the matrix "edge" of the plotted tree - not the node indices of the
daughter node of each edge, for instance.
Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org
On 7/30/2015 4:45 PM, Klaus Schliep wrote:
Dear Julia,
this function should fix your problem and Emmanuel may can include it into
edgelables function:
edgeLabelsFan <- function (text, edge, adj = c(0.5, 0.5), frame = "rect",
pch = NULL,
thermo = NULL, pie = NULL, piecol = NULL, col = "black",
bg = "lightgreen", horiz = FALSE, width = NULL, height = NULL,
date = NULL, ...)
{
lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
if (missing(edge)) {
sel <- 1:dim(lastPP$edge)[1]
subedge <- lastPP$edge
}
else {
sel <- edge
subedge <- lastPP$edge[sel, , drop = FALSE]
}
r <- sqrt(lastPP$xx^2 + lastPP$yy^2)
XX <- lastPP$xx[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
YY <- lastPP$yy[subedge[,2]] * (r[subedge[,2]] + r[subedge[,1]]) /
(r[subedge[,2]] * 2)
if (!is.null(date))
XX[] <- max(lastPP$xx) - date
BOTHlabels(text, sel, XX, YY, adj, frame, pch, thermo, pie,
piecol, col, bg, horiz, width, height, ...)
}
Kind regards,
Klaus
On Thu, Jul 30, 2015 at 1:10 PM, Julia Dupin <julia.du...@gmail.com> wrote:
Dear all,
I'm trying to plot a tree with some branches marked using edgelabels() but
the function is misplacing the labels (it misses the actual branches) when
I use it in a "fan" type tree.
Here is an example
tree<-pbtree(n=10,scale=10)
plot(tree,type="fan")
edgelabels()
The phylogeny I am working on is pretty big so "fan" is the best option for
me to visualize it.
Has anyone had this issue before? Is there a way to fix it? Or maybe an
alternative to edgelabels?
Thanks in advance!!
Julia
--
Julia Dupin
PhD candidate
Smith lab
Dept. Ecology and Evolutionary Biology, Ramaley Hall C127A
University of Colorado - Boulder
email: julia.du...@colorado.edu
website: http://www.colorado.edu/smithlab/
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/r-sig-phylo@r-project.org/
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/