Re: [R-sig-phylo] Aligning tree tip labels together in ape

2018-08-27 Thread Carleson, Nick
Hello,

I used the code insertion that Emmanuel provided, and that solved my issue.
Thank you all for the help and discussion!

Pascal, if you're looking for a tutorial, this is the first one I found
when I started:
http://www.phytools.org/eqg/Exercise_3.2/

I've found it *very* helpful. I've also worked through this one, which uses
ggtree like you're looking into:
https://4va.github.io/biodatasci/r-ggtree.html

For specifics, it would help if you came up with a minimum reproducible
example
<https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example>
and shared it (especially code!). You might get a better response from
people.

Cheers



On Sat, Aug 25, 2018 at 11:53 PM, pascal de Clarens 
wrote:

> Hello,
>
> I am using Iramuteq with ape and get the trees with iriba method
> I have not yet understand how to make  a phylogenic tree ... is there a
> tutorail available?
>
> I installed the ggtree package, but when I try to use the Reinert
> classification method I gnow get this message:
>
> None
>
> Warning message:
>
> package ‘Matrix’ was built under R version 3.4.4
>
> There were 42 warnings (use warnings() to see them)
>
> There were 25 warnings (use warnings() to see them)
>
> Warning message:
>
> package ‘ape’ was built under R version 3.4.4
>
> Error in Ntip + Nnode : non-numeric argument to binary operator
>
> Calls: plot.dendropr -> plot.phylo
>
> Execution halted
>
>
> thanks for your help
>
>
> best regards
>
> Le ven. 24 août 2018 à 17:59, Bjørn Tore Kopperud 
> a écrit :
>
>> Hi Nick,
>>
>>
>> There is a fantastic package for visualizing trees, the "ggtree" package:
>>
>>
>> https://github.com/GuangchuangYu/ggtree
>>
>>
>> Here is a vignette with several examples on how to display trees,
>> including your circular phylogram visualization:
>>
>>
>> https://bioconductor.org/packages/devel/bioc/vignettes/ggtree/inst/doc/
>> treeVisualization.html#phylogram-and-cladogram
>>
>>
>> You can read the documentation to figure out how to plot tip labels, I'm
>> sure it's possible. The ggtree package is very powerful but also different
>> in comparison with ape, as it is built on top of the "grammar of graphics"
>> ggplot package.
>>
>>
>> Best,
>>
>> Bjørn Tore Kopperud
>>
>>
>> G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for
>> visualization and annotation of phylogenetic trees with their covariates
>> and other associated data. *Methods in Ecology and Evolution*. 2017,
>> 8(1):28-36.​
>>
>>
>>
>> --
>> *From:* R-sig-phylo  on behalf of
>> Carleson, Nick 
>> *Sent:* 24 August 2018 17:04
>> *To:* r-sig-phylo@r-project.org
>> *Subject:* [R-sig-phylo] Aligning tree tip labels together in ape
>>
>> Hello all,
>>
>> I'm using the R package 'ape' to make non-ultrametric phylogenetic trees
>> . I want to align tip labels together when drawing a tree with
>> plot.phylo(), and also add on more labels using the tiplabels()
>> function. But, I can't get additional tip labels from tiplabels aligned
>> properly with those from plot.phylo. When I call tiplabels, the labels
>> are being drawn at the true edge length instead of neatly around the plot
>> with the tip labels drawn by plot.phylo. So, in the plot below, I want
>> the tip labels (circles) to be aligned adjacent to the tip labels (names)
>> drawn by plot.phylo.
>>
>> Good: tips like t30, t31, and t2
>> Bad: tips like t1, t20, and t21
>>
>>
>>
>>
>> Can anyone help me out?
>>
>> Below is the code to produce the tree above. I'm using ape version 5.1
>> and R version 3.4.3.
>>
>> library(ape)
>> set.seed(31)
>> sim_tree <- rlineage(0.1, 0.05)
>> plot.phylo(sim_tree, type = "fan", align.tip.label = TRUE)
>> tiplabels(pch = 19, col = rainbow(3), offset = 6)
>>
>> Thanks all!
>>
>>
>> *Nick Carleson *
>>
>> PhD Student
>> * | Oregon State University *Graduate Research Assistant | *Botany and
>> Plant Pathology*
>> ___
>> 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-ph...@r-project.org/
>>
>
>
> --
> Pascal de Clarens
> 06 07 85 22 54
>



-- 


*Nick Carleson*

PhD Student
* | Oregon State University *Graduate Research Assistant | *Botany and
Plant Pathology*

[[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] Aligning tree tip labels together in ape

2018-08-25 Thread Emmanuel Paradis

Hi Nick,

This can be fixed by editing the code of tiplabels() with the usual 
procedure:


fix(tiplabels)

then find this line of code:

tmp <- rect2polar(XX, YY)

and insert below the following one:

if (lastPP$align.tip.label) tmp$r[] <- max(tmp$r)

save and close. Your commands work for me after this fix. You should 
then be able to add series of labels with increasing values of offset:


tiplabels( offset = 6)
tiplabels( offset = 8)
tiplabels( offset = 10)

Best,

Emmanuel

Le 24/08/2018 à 17:04, Carleson, Nick a écrit :

Hello all,

I'm using the R package 'ape' to make non-ultrametric phylogenetic trees 
. I want to align tip labels together when drawing a tree with 
plot.phylo(), and also add on more labels using the tiplabels() 
function. But, I can't get additional tip labels from tiplabels aligned 
properly with those from plot.phylo. When I call tiplabels, the labels 
are being drawn at the true edge length instead of neatly around the 
plot with the tip labels drawn by plot.phylo. So, in the plot below, I 
want the tip labels (circles) to be aligned adjacent to the tip labels 
(names) drawn byplot.phylo.


Good: tips like t30, t31, and t2
Bad: tips like t1, t20, and t21




Can anyone help me out?

Below is the code to produce the tree above. I'm using ape version 5.1 
and R version 3.4.3.


library(ape)
set.seed(31)
sim_tree <- rlineage(0.1, 0.05)
plot.phylo(sim_tree, type = "fan", align.tip.label = TRUE)
tiplabels(pch = 19, col = rainbow(3), offset = 6)

Thanks all!

**Nick Carleson*
*

**

PhD Student*| Oregon State University
*Graduate Research Assistant | *Botany and Plant Pathology**
*


Pour nous remonter une erreur de filtrage, veuillez vous rendre ici 






___
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] Aligning tree tip labels together in ape

2018-08-24 Thread Liam J. Revell

Hi Nick.

The following is a 'solution' that works with phytools; however, you 
should keep in mind that you will not generally be able to use a 
constant offset value if your tip labels vary in length. In that case, 
you would either have to use a variable offset or figure out the minimum 
offset required such that the circles fall outside of the taxon labels.


library(phytools)
par(lty="dotted",fg="black")
plotTree(force.ultrametric(sim_tree,"extend"),type="fan",lwd=1)
tiplabels(pch = 19, col = rainbow(3), offset = 6)
par(lty="solid",fg="transparent")
plotTree(sim_tree,type="fan",lwd=1,add=TRUE)
par(fg="black")

For a more general solution you might offset your taxon labels by a 
constant amount, or you can use the function strwidth and some basic 
trigonometry to find the position outside the taxon labels to draw your 
circles.


All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 8/24/2018 10:04 AM, Carleson, Nick wrote:

Hello all,

I'm using the R package 'ape' to make non-ultrametric phylogenetic trees 
. I want to align tip labels together when drawing a tree with 
plot.phylo(), and also add on more labels using the tiplabels() 
function. But, I can't get additional tip labels from tiplabels aligned 
properly with those from plot.phylo. When I call tiplabels, the labels 
are being drawn at the true edge length instead of neatly around the 
plot with the tip labels drawn by plot.phylo. So, in the plot below, I 
want the tip labels (circles) to be aligned adjacent to the tip labels 
(names) drawn byplot.phylo.


Good: tips like t30, t31, and t2
Bad: tips like t1, t20, and t21




Can anyone help me out?

Below is the code to produce the tree above. I'm using ape version 5.1 
and R version 3.4.3.


library(ape)
set.seed(31)
sim_tree <- rlineage(0.1, 0.05)
plot.phylo(sim_tree, type = "fan", align.tip.label = TRUE)
tiplabels(pch = 19, col = rainbow(3), offset = 6)

Thanks all!

**Nick Carleson*
*

**

PhD Student*| Oregon State University
*Graduate Research Assistant | *Botany and Plant Pathology**
*



___
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] Aligning tree tip labels together in ape

2018-08-24 Thread Bjørn Tore Kopperud
Hi Nick,


There is a fantastic package for visualizing trees, the "ggtree" package:


https://github.com/GuangchuangYu/ggtree


Here is a vignette with several examples on how to display trees, including 
your circular phylogram visualization:


https://bioconductor.org/packages/devel/bioc/vignettes/ggtree/inst/doc/treeVisualization.html#phylogram-and-cladogram


You can read the documentation to figure out how to plot tip labels, I'm sure 
it's possible. The ggtree package is very powerful but also different in 
comparison with ape, as it is built on top of the "grammar of graphics" ggplot 
package.


Best,

Bjørn Tore Kopperud


G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization 
and annotation of phylogenetic trees with their covariates and other associated 
data. Methods in Ecology and Evolution. 2017, 8(1):28-36.?




From: R-sig-phylo  on behalf of Carleson, 
Nick 
Sent: 24 August 2018 17:04
To: r-sig-phylo@r-project.org
Subject: [R-sig-phylo] Aligning tree tip labels together in ape

Hello all,

I'm using the R package 'ape' to make non-ultrametric phylogenetic trees . I 
want to align tip labels together when drawing a tree with plot.phylo(), and 
also add on more labels using the tiplabels() function. But, I can't get 
additional tip labels from tiplabels aligned properly with those from 
plot.phylo. When I call tiplabels, the labels are being drawn at the true edge 
length instead of neatly around the plot with the tip labels drawn by 
plot.phylo. So, in the plot below, I want the tip labels (circles) to be 
aligned adjacent to the tip labels (names) drawn by plot.phylo.

Good: tips like t30, t31, and t2
Bad: tips like t1, t20, and t21

[cid:ii_jl74vfw93_16568e27b224020e]


Can anyone help me out?

Below is the code to produce the tree above. I'm using ape version 5.1 and R 
version 3.4.3.

library(ape)
set.seed(31)
sim_tree <- rlineage(0.1, 0.05)
plot.phylo(sim_tree, type = "fan", align.tip.label = TRUE)
tiplabels(pch = 19, col = rainbow(3), offset = 6)

Thanks all!


Nick Carleson

PhD Student | Oregon State University
Graduate Research Assistant | Botany and Plant Pathology
___
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] Aligning tree tip labels together in ape

2018-08-24 Thread Carleson, Nick
Hello all,

I'm using the R package 'ape' to make non-ultrametric phylogenetic trees .
I want to align tip labels together when drawing a tree with plot.phylo(),
and also add on more labels using the tiplabels() function. But, I can't
get additional tip labels from tiplabels aligned properly with those from
plot.phylo. When I call tiplabels, the labels are being drawn at the true
edge length instead of neatly around the plot with the tip labels drawn by
plot.phylo. So, in the plot below, I want the tip labels (circles) to be
aligned adjacent to the tip labels (names) drawn by plot.phylo.

Good: tips like t30, t31, and t2
Bad: tips like t1, t20, and t21




Can anyone help me out?

Below is the code to produce the tree above. I'm using ape version 5.1 and
R version 3.4.3.

library(ape)
set.seed(31)
sim_tree <- rlineage(0.1, 0.05)
plot.phylo(sim_tree, type = "fan", align.tip.label = TRUE)
tiplabels(pch = 19, col = rainbow(3), offset = 6)

Thanks all!


*Nick Carleson*

PhD Student
* | Oregon State University *Graduate Research Assistant | *Botany and
Plant Pathology*
___
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/