I'm running a MacOS
Mojav
e with R Studio Version 1.2.1335
. I am trying to change the colors of the tip labels on a phylogenetic
tree that I uploaded to R
via a nexus
file. I have a separate CSV
file with all of the species names in the exact format as the nexus
file. In the CSV
I have a "yes" or "no" in the column next to the species names. The species name column is called Tree_name and the other column is "have". I want the species that have "no" next to them to be colored red and the others colored black. I am new to using R
to plot phylogenies
. Any help would be greatly appreciated!
I have tried to do a similar thing using dots but keep coming up with this error
Error in res[edge[i, 2]] <- res[edge[i, 1]] + el[i] :
replacement has length zero
This is the code I have tried:
shark.data<-read.csv("sharks_nosquatinis_format.csv",row.names=1)
dotTree(str_tree_sharks,shark.data,colors=setNames(c("blue","red"),
c("yes","no")),ftype="i",fsize=0.7)