I have created the following tree using the code below.
library(ape)
library(phytools)
#Create Random Trees just for demo purposes
TreeA<-rtree(10)
TreeB<-rtree(10)
#Convert both trees to cladograms
TreeA<-compute.brlen(TreeA)
TreeB<-compute.brlen(TreeB)
#creation of the association matrix:
association <- cbind(TreeB$tip.label, TreeB$tip.label)
searchstring1<-c("t1","t3")
searchresult1<-which(Reduce(`|`, lapply(searchstring1, grepl, x=association[,1])))
#Define which associations get a different color connector
col<-rep(make.transparent("blue",0.4),nrow(association))
col[c(searchresult1)]<-make.transparent("red",0.4)
#Build the cophylo object
obj<-cophylo(TreeA,TreeB,assoc=association, rotate=TRUE)
#Get set to export the plotted trees
setwd("C:/Users/jamie/Desktop/")
pdf(file="cophyloexample.pdf",height=14,width=14)
#Build the plot
plot(obj,link.type="curved",link.lwd=3, link.lty="solid", link.col=col, fsize=5, hang=-1)
I have tried tiplabel.color=col, label.col=col, tip.col=col, etc.
There is no documentation that I can find showing how this is done. How can this be done?
I have been successful in coloring the connectors but I can't figure out how to color the tip labels the same as the connector. For example, t10, t3 and t1 all need to be red. How can this be accomplished.
