#load ape package
library('ape')
#read a selected trees file; select nexus trees file in pumped
window, and name it as treesForLTT
read.nexus(choose.files())->treesForLTT
#read one tree (the best tree)
read.nexus(choose.files())->oneTreeForLTT
#check how many trees are there in treesForLTT
treesForLTT
#burn some trees.30% of total trees is acceptable. Set your
own number.
treesForLTT[3000:10001]->fineTreesForLTT
#It could be slow if there are too many trees. Discard more
trees will help.
#预画图
#draw LTT plot of all fine trees.
mltt.plot(fineTreesForLTT, legend = F, dcol = F, ylab =
'Number of Lineages', xlab = 'Time')
#add the best tree
ltt.lines(oneTreeForLTT, col = 'red', lwd = 2)
得到图片如下:
图太长了。因为一些树左边的枝太长太长。另外,黑色太厚实了,不好看。
#重写mltt.plot函数并修图
#添加了两个参数,xrange限制x轴的范围;owncol指定线的颜色。
#the x axis is so long. Has to be black in mltt.plot?
#Don't know how to change xlim and line color in mltt. So
stupid am I.
#so rewrite function mltt.plot into Own.mltt.plot</