There is a small bug actually: label.offset is ignored with type = "unrooted" (unless lab4ut = "axial"). This is now fixed.

Best,

Emmanuel

Le 01/07/2016 09:37, Emmanuel Paradis a écrit :
Hi Kamila,

The vectors x and y extracted by Liam are ordered in the same way than
the tip labels of the tree (say its names is 'phy'); for instance, the
followings should do the same output than plot(phy):

plot(phy, show.tip.label = FALSE)
obj <- get("last_plot.phylo", envir = .PlotPhyloEnv)
x <- obj$xx[1:obj$Ntip]
y <- obj$yy[1:obj$Ntip]
text(x, y, phy$tip.label)

Another R function that may be useful in your case is locator if you
plot the tree interactively (i.e., this will not work if using pdf(),
png(), ...). This may use in different ways, for instance:

text(locator(1), NULL, "Label to be placed interactively")

You then click on the graphical window where you want to add the text.

Best,

Emmanuel

Le 01/07/2016 05:47, Kamila Naxerova a écrit :
Thanks so much for your reply, Liam.

Most of the tip labels plotted by plot.phylo are in an optimal place,
but while plotting a large number of trees, I have observed some
“outliers" where the tip label is mispositioned and overlaps with the
edge. Therefore, I would like to move some of those “bad” labels.

I am afraid my grasp of R’s underbelly is not profound enough to
understand how to implement your last suggestion. It seems that you
are extracting the tip label xy coordinates from the last tree that
was plotted, but how do you then assign the new, modified coordinates
to a new plot?

Thanks again for helping with this, it’s much appreciated.

Kamila

On Jun 29, 2016, at 10:32 PM, Liam J. Revell <liam.rev...@umb.edu>
wrote:

Dear Kamila.

In what way would you like to adjust the tip labels? The most useful
adjustment that I have found is the argument lab4ut="axial" which
plots the labels with the angle of the corresponding terminal edge.
It is also possible to offset the tip labels using label.offset>0.

We can also get the positions of the tips in the coordinates of our
plotting device as follows:

obj<-get("last_plot.phylo",envir=.PlotPhyloEnv)
x<-obj$xx[1:obj$Ntip]
y<-obj$yy[1:obj$Ntip]

You can then use these coordinates to plot your labels any way you
choose!

- Liam

Liam J. Revell, Associate 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 6/29/2016 5:11 PM, Kamila Naxerova wrote:
Dear all,

is there a way to adjust the position of tip labels when plotted an
unrooted tree with plot.phylo?

Many thanks,
Kamila



The information in this e-mail is intended only for t...{{dropped:24}}

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

Reply via email to