Dear Gudrun,

almost right, try this code:
set.seed(42)
tree<-pbtree(n=10)
tree$tip.label<-c("A","B","Q","M","C","D","F","X","Z","W")
color<-rep("black",length(tree$tip.label))
color[which(tree$tip.label=="A")]<-"red"
edgecolor<-rep("black",length(tree$edge))
plot(tree)
edgelabels()
# edge 3 leads to A
edgecolor[3]<-"red"
plot(tree, edge.color=edgecolor)

Regards,
Klaus


On Tue, Jan 26, 2016 at 3:06 AM, Gygli, Gudrun <gudrun.gy...@wur.nl> wrote:

> Dear fellow phylo-R users,
>
>
> I am trying to colour tree (terminal and non terminal) branches in the
> same colour as the tip of said branch.
>
>
> To illustrate, see the code below, which is almost doing what I want. You
> can see that only colouring a specific tip, which is called A in this
> example, is no problem.
>
>
> However, I cannot colour the branches leading up to tip "A" in red with
> this code. I tried using tree$edge, but this is not working the way I
> thought.
>
>
> Does anyone know how to colour all the branches leading up to tip "A" in
> red?
>
>
> tree<-pbtree(n=10)
> tree$tip.label<-c("A","B","Q","M","C","D","F","X","Z","W")
> color<-rep("black",length(tree$tip.label))
> color[which(tree$tip.label=="A")]<-"red"
> edgecolor<-rep("black",length(tree$edge))
> edgecolor[which(tree$tip.label=="A")]<-"red"
>
>
> Thanks a lot for any help.
>
>
> Best regards
>
>
> G
>
>
>
> Gudrun Gygli, MSc
>
> PhD candidate
>
> Wageningen University
> Laboratory of Biochemistry
> Dreijenlaan 3
> 6703 HA Wageningen
> The Netherlands
>
> Phone  31 317483387
> e-mail: gudrun.gy...@wur.nl
>
> - - - - - - - - - - - - - - - - - -
>
> Project information:
> http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm
>
> _______________________________________________
> 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/
>



-- 
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston

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

Reply via email to