R programming language resources › Forums › Data manipulation › legend a phylogenetic tree
Tagged: color, legend, phylogenetic, tree
- This topic has 0 replies, 1 voice, and was last updated 12 years, 1 month ago by
andreiar.
- AuthorPosts
- March 23, 2013 at 1:32 am #896
andreiar
Memberhi guys
im new with R and im stuck here with little thing … make a simple legend :s
i want to put a legend on bottom right of page (tiff format) with title “Equinodermata Classes” and identifying the classes (the names with different colours that i already have in my phylogenetic tree). So the Asteroidea its one classe and i want write this word in blue because the leaves of my tree in green are from Asteroidea, with same case Echinoidea but in red …
im trying to do like this:
<code>
classes <- c(“Classe Holothuroidea”, “Classe Asteroidea”)
for (i in classes) {
if (i==”Classe Holothuroidea”) text.col =”green”
if (i==”Classe Asteroidea”) text.col =”blue”
{
plot.phylo (ATP8, show.node.label=TRUE, tip.color = my_tip_color, use.edge.length = TRUE, font = 2, edge.width=2, x.lim =6.0, y.lim=29, cex=0.6)
legend(“bottomright”, legend = c(“Classe Asteroidea”, “Echinoidea”, “Classe Holothuroidea”, “Ophiuroidea”),title = “Equinodermata Classes”, text.col = my_tip_color, cex=0.7)
classes <- c(“Classe Holothuroidea”, “Classe Asteroidea”)
for (i in classes) {
if (i==”Classe Holothuroidea”) text.col =”green”
if (i==”Classe Asteroidea”) text.col =”blue”
{
tiff(“atp8_treeingroup.tif”, compression = “lzw”)
plot.phylo (ATP8, show.node.label=TRUE, tip.color = my_tip_color, use.edge.length = TRUE, font = 2, edge.width=2, x.lim =6.0, y.lim=29, cex=0.6)
mtext (“ATP8 TREE – ingroup”, side = 3, font = 2, adj = 1, cex=1.0)
legend(“bottomright”, legend = c(“Classe Asteroidea”, “Echinoidea”, “Classe Holothuroidea”, “Ophiuroidea”),title = “Equinodermata Classes”, text.col = classes, cex=0.7)
</code>
The problem is .. i get the legend in green (all even the title) … can you help me with this?
thanks 🙂
- AuthorPosts
- You must be logged in to reply to this topic.