Я пытаюсь построить филогенетическое дерево, но каждый раз, когда я пытаюсь построить его, оно выдает следующую ошибку:
Error in as.graphicsAnnot(legend) : argument "legend" is missing, with no default
Вот MWE:
library(ape)
library(phangorn)
tr <- read.tree(text = "(((L2,L3),L4),L1);")
df <- data.frame(L1 = c(0,0,1,0,0,0,1,1,1,1,0,0,0,0,1), L2 =
c(0,1,1,0,1,1,0,1,1,0,1,1,0,1,1),L3 = c(1,1,1,0,0,0,1,1,1,0,0,0,1,1,1),
L4=c(0,0,1,1,0,0,0,0,1,1,0,0,0,0,1))
phydat <- as.phyDat(df,type="USER",levels=c(1,0),names=names(df))
anc.tree <- pratchet(phydat) #ratchet search
anc.tree <- optim.parsimony(anc.tree,phydat) #NNI optimization
anc.tree <-root(anc.tree,outgroup = "L1", resolve.root = TRUE) #roots the tree
anc.tree <- acctran(anc.tree,phydat) #adds branch lengths
anc.acctran <- ancestral.pars(anc.tree,phydat, "ACCTRAN")
Следующий вызов plotAnc()
выдает ошибку об отсутствующей легенде выше:
plotAnc(anc.tree,anc.acctran,1)
Я пытался вызвать следующую функцию до plotAnc()
:
legend("bottomright", "foo")
Я все еще получилсообщение об ошибке в легенде.Что я делаю не так?