Hi all.

I would be very pleased if someone could help me, as I do not seem to get the 
different branches of my tree painted in different colours. The closest I get 
is colouring the names of my samples(=names of the branches). Here is the code.






data <- read.table(file = "S://SEDIM//TRFLP//B12.5_50-700bp.txt" , as.is = 
TRUE, header = TRUE, sep = "\t", row.names = 1)#define vector with depths of 
samples









row.names(data)<-



 
c("119","175","135","330","51","422","67.0","409","470.0","70","67","89","134.5","215","330.0","409.0","470","50.5","80","119.0","174.5","222","301","421.5","280","171","256","243","404","37","157","28","187.0","79.5","42.0","283","261","85","147","204.0","235","411.0","514","77","204","87","366","306","351","371","38","534","199","407","42","167","480","195","22","35","80.0","433","43","109","214","363","292","61","115","178","273","521","72","126","253","288","501","82.5","113","250","359.0","498","19","130","389","324","24","58","124","388","319.0","164.0","101.0","153","383","345","219","179","161","375","298","450.0","555","439","54","54.5","490","465","411","18.0","85.0","503","455","394","179.0","187","416","447","219.0","461","164","366.0","474","167.0","236","507","319","509","467","507.5","450","359","507.0","192","453","101","456","512","517")

 depths <- 
c("119","175","135","330","51","422","67.0","409","470.0","70","67","89","134.5","215","330.0","409.0","470","50.5","80","119.0","174.5","222","301","421.5","280","171","256","243","404","37","157","28","187.0","79.5","42.0","283","261","85","147","204.0","235","411.0","514","77","204","87","366","306","351","371","38","534","199","407","42","167","480","195","22","35","80.0","433","43","109","214","363","292","61","115","178","273","521","72","126","253","288","501","82.5","113","250","359.0","498","19","130","389","324","24","58","124","388","319.0","164.0","101.0","153","383","345","219","179","161","375","298","450.0","555","439","54","54.5","490","465","411","18.0","85.0","503","455","394","179.0","187","416","447","219.0","461","164","366.0","474","167.0","236","507","319","509","467","507.5","450","359","507.0","192","453","101","456","512","517")#function
 for labelling plotting figures

MyFun <- function(x){

          if
(x < 100) {

                   x
<- 1

}

          if
(x > 100 & x < 200){

                   x
<- 2

} 

          if
(x > 200 & x < 300){

                   x
<- 3

} 

          if
(x > 300 & x < 400){

                   x
<- 4

} 

          if
(x > 400 & x < 500){

                   x
<- 5

} 

          if
(x > 500){

                   x
<- 6

          }

          return((x))

}




#apply the function to the dataset

sapply(depths, MyFun)->symbols

 

#create the vectors for the plotfigures

as.vector(symbols)->symbols



library(ape)

col.vec<-symbols



plot(as.phylo(hclust(dist((data)))),tip.color=col.vec,main=" Hierarchical
cluster analysis ") I need to change the tip.color into something else, but 
what?Even better would be if someone could help me changing the colours given 
according to the depth of the sample (according to how high a number I have 
given the samples in row.names), I mean getting darker as the samples get 
deeper etc.. Is there an easy way doing this?

Thank you so much in advance,all help appreciated.
Regards, Yvonne
 

_________________________________________________________________
[[elided Hotmail spam]]

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to