[R] change the label size when drawing trees with ape

Hua Li hualihua at yahoo.com
Fri Feb 20 00:21:44 CET 2009


Hi All,

I want to be able to change the labe size on a tree
when using ape package so that the graph can look
nicer, but don't know how. Playing with the "font"
doesn't seem to help. (Right now the labels barely
show.) 

Thanks for your help!

Code I'm using now

#-------------------------
t1 = "(((1:77.37,2:77.37):9.4,4:86.77):7.56,3:94.33);"
t2 = "((1:12.56,(2:10.11,4:10.11):2.45):1.64,3:14.2);"
t3= 
"(((1:57.54,3:57.54):11.54,4:69.08):4.13,2:73.21);"
t4 =
"(1:59.27,((2:34.77,3:34.77):6.99,4:41.76):17.51);"
t5 =
"(((1:22.26,4:22.26):3.4,3:25.66):15.81,2:41.47);"
t6 = "(((1:23.3,2:23.3):22.2,3:45.5):37.88,4:83.38);"
t7 =
"(((1:18.49,3:18.49):1.14,4:19.63):5.93,2:25.56);"
t8 =
"((1:40.26,2:40.26):31.51,(3:38.99,4:38.99):32.78);"
t9 =
"(1:60.72,((2:15.57,4:15.57):5.07,3:20.64):40.08);"
t10 =
"((1:54.81,3:54.81):13.81,(2:64.24,4:64.24):4.38000000000001);"
t11 =
"((1:61.44,3:61.44):26.94,(2:26.52,4:26.52):61.86);"
t12 =
"((1:11.05,(3:10.15,4:10.15):0.9):68.71,2:79.76);"
t13 =
"(((1:39.53,3:39.53):6.25,4:45.78):3.09,2:48.87);"
t14 =
"((1:55.12,(2:37.99,3:37.99):17.13):18.28,4:73.4);"
t15 =
"((1:73.39,(2:54.24,4:54.24):19.15):20.58,3:93.97);"


library(ape)

ft = c(5,5,5,5)
postscript("test.ps")
par(mfrow=c(5,3))
plot(read.tree(text=t1),font=ft)
plot(read.tree(text=t2),font=ft)
plot(read.tree(text=t3),font=ft)
plot(read.tree(text=t4),font=ft)
plot(read.tree(text=t5),font=ft)
plot(read.tree(text=t6),font=ft)
plot(read.tree(text=t7),font=ft)
plot(read.tree(text=t8),font=ft)
plot(read.tree(text=t9),font=ft)
plot(read.tree(text=t10),font=ft)
plot(read.tree(text=t11),font=ft)
plot(read.tree(text=t12),font=ft)
plot(read.tree(text=t13),font=ft)
plot(read.tree(text=t14),font=ft)
plot(read.tree(text=t15),font=ft)
dev.off()




More information about the R-help mailing list