Dear all,
I am attempting to plot ancestral reconstructions (using asr.marginal in
Diversitree) of a discrete trait on a number of subtrees (subtree=T in ape),
but I'm having trouble assigning node probabilites and tip states to the
correct nodes and tips.
I have been using the following code:
#Extract state probabilitiesst <- asr.marginal(lik.l,
coef(fit.l))pie.probs<-t(st) pr<-apply(t(st), 1, which.max)tree$node.label<-pr
#Assign colours to extant statesstatesLabel <- statesnames(statesLabel) <-
names(states)statesLabel[states==1] <- "red"statesLabel[states==2] <-
"blue"statesLabel[states==3] <- "green"
#Extract subtreetrd <- drop.tip(tree, 65:761, subtree=T)
#Plot subtreeplot(trd, show.tip.label=T, edge.width
=1)nodelabels(pie=pie.probs,piecol=c("red", "blue", "green"))tiplabels(pch=22,
bg=statesLabel)
This works fine for my first subtree, i.e. tips 1-64, but when I try running
the same code on subsequent parts of the tree, visual inspection confirms that
tip colours and node probabilities are no longer correctly assigned to the
correct tips and nodes.
#I.e. running the following code plots the correct subtree, but states are
incorrectly assigned to nodes and tips. trd <- drop.tip(tree, c(1:64, 167:761),
subtree=T)plot(trd, show.tip.label=T, edge.width
=1)nodelabels(pie=pie.probs,piecol=c("red", "blue", "green"))tiplabels(pch=22,
bg=statesLabel)
I'm guessing the solution is quite simple, but I haven't been able to work it
out. Any suggestions would be greatly appreciated.
Kind regards,Petter Zahl Marki
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/