Re: [R-sig-phylo] Adjust position of tip labels in plot.phylo

2016-07-01 Thread Kamila Naxerova
Thank you so very much for helping me with this! This is the perfect solution.

Kamila
> On Jul 1, 2016, at 3:37 AM, Emmanuel Paradis  wrote:
> 
> 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  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/ 
>> 


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

___
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] Reconstruction of ancestral character state with no organ

2016-07-01 Thread Wu, Cheng-Chiang
Dear All,

I am working on reconstruction of ancestral character state with a trait of 
three states (0,1, 2) of a specific organ from 100 taxa.
Per tutorials on 
http://blog.phytools.org/2015/09/primer-on-estimating-ancestral-states.html and 
http://blog.phytools.org/2013/04/estimating-ancestral-states-when.html,
I set 1/3 as prior probability of being in any of the states for taxa with the 
organ but no trait data (missing data).
For the three taxa which don't have this organ, I had to set 1/3 instead of 0 
as prior probability for each state, in order to running rerootingMethod or 
make.simmap functions in phytools properly. I tried to set 0 as prior 
probability for all states of these three taxa in the matrix, and I got the 
following error messages by runing rerooting Method or make.simmap:

rerootingMethod:
Error in fitMk(tt, yy, model = model, fixedQ = Q, output.liks = 
TRUE)$lik.anc[1,  :
  incorrect number of dimensions

make.simmap:
Error in 1:nrow(L) : argument of length 0

I thought about deleting the three taxa without such organ from my dataset, but 
they are critical in the phylogeny.

May I ask for advice on solution for this issue?

Thanks,
Cheng-Chiang


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


Re: [R-sig-phylo] Adjust position of tip labels in plot.phylo

2016-07-01 Thread Emmanuel Paradis
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 
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/

Re: [R-sig-phylo] Adjust position of tip labels in plot.phylo

2016-07-01 Thread Emmanuel Paradis

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