Hi Will,

This issue comes out from time to time (last time for me during a workshop last week). So I just wrote a function to do that:

drawSupportOnEdges <- function(value, ...)
{
    lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
    n <- lastPP$Ntip
    m <- lastPP$Nnode
    if (length(value) == m) value <- value[-1]
    if (length(value) != m - 1)
        stop("incorrect number of support values")
    nodes <- 2:m + n
    i <- match(nodes, lastPP$edge[, 2])
    edgelabels(value, i, ...)
}

Note that 'value' should be a vector of length equal to the number of edges or to the number of nodes. In the latter case, the first value (supposed to be for the root node) is removed.

As usual, the '...' argument can be used for any option accepted by edgelabels().

An alternative with nodelabels, if the number of support values is equal to the number of nodes, is to use the 'adj' option:

nodelabels(value, adj = 1)

the labels will be printed on the correct edges, although on the extremity.

Best,

Emmanuel

Le 02/02/2016 07:06, William Gearty a écrit :
Hi all,

I have some tree files with bootstrap support values associated with the
nodes.
Of course, these bootstrap support values should really be associated with
the branches, not the nodes, especially as I prepare these trees as figures
for publication.

So, my question is, once I have imported my tree into R, is there a
[simple] way to convert these node labels to edge labels?
I've searched around on the internet and in the r-sig-phylo archives, but
haven't been able to find anything.

If anyone knows of an archived email thread or blog post that has already
answered this inquiry, please feel free to point me in that direction.

Thanks in advance,
Will


_______________________________________________
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/

Reply via email to