Hi Martin.
The solution of Gopal will work to change the color scheme of the
'densityMap' object, but this is also automated in the function setMap.
For example (in which trees is our 'multiSimmap' object):
obj<-densityMap(trees,res=200,plot=FALSE)
plot(obj) ## original color gradient
obj<-setMap(obj,invert=TRUE)
plot(obj) ## flipped color gradient
obj<-setMap(obj,c("blue","green","yellow"))
plot(obj,outline=TRUE,lwd=4) ## arbitrary gradient
However, you have probably noted that the function plots the posterior
probability of being in a given state, by default the alphanumerically
second of the two mapped states. This can also be changed as follows (in
which x is our trait vector):
ss<-sort(unique(x))[2:1]
obj<-densityMap(trees,res=200,plot=FALSE,states=ss)
plot(obj)
In this case what should be plotted is the posterior probability of
being in the alphanumerically first state, rather than the second.
All the best, Liam
Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org
Hi Martin, The below code might help you.
require(phytools) tree<-pbtree(n=100) # simulate tree
s<-sample(c(0,1),100,replace = T) # create character state
names(s)<-tree$tip.label # assign tip labels to character state
mtreel<-make.simmap(tree,s,nsim=10) XX <- densityMap(mtreel, lwd =
2,ftype="off") s<-colorRampPalette(c("green","red")) # change the
colors here XX$cols[]<-s(length(XX$cols)) plot(XX, lwd =
2,ftype="off",outline=FALSE)
Regards, Gopal Murali
---------------------------------------------------------------------
*“**How strange is the lot of us mortals! Each of us is here for a
brief sojourn; for what purpose he knows not, though he sometimes
thinks he senses it. But without deeper reflection one knows from
daily life that one exists for other people…a hundred times every day
I remind myself that my inner and outer life are based on the labors
of other men, living and dead, and that I must exert myself in order
to give in the same measure as I have received and am still
receiving,”* ― Albert Einstein
<http://www.goodreads.com/author/show/9810.Albert_Einstein>
-------------------------------------------------------------------------------------
Post by r***@macn.gov.arHello,
I want to change the colors of a Bayesian stochastic mapping,
using make.simmap (e.g., switching blue and red). Is it possible?
(I tried switching the order of the columns of the states -- no effect.)
Thanks for any help!
Martin Ramirez
_______________________________________________ R-sig-phylo mailing
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable
[[alternative HTML version deleted]]
_______________________________________________ R-sig-phylo mailing
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive
_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/