Thanks for the so fast help, both Andrés and Liam. Glad it helped getting this nice function even better.
Cheers Agus 2013/11/26 Liam J. Revell <liam.rev...@umb.edu> > Hi Agus. > > I encountered two problems: > > 1) The function phenogram(...,spread.labels=TRUE) has a bug when labels > in the plotted traitgram don't actually overlap. This has now been fixed ( > http://blog.phytools.org/2013/11/bug-fix-for- > phenogramspreadlabelstrue.html). > > 2) The dimensions of your plotted .tif are two small, which causes the > distortion that I think you found. Just by multiplying both dimensions of > the plotting object by 4 (to 22 & 28) I was able to create the attached > .tif with no other changes to your code. > > Thanks for using phytools. > > All the best, Liam > > Liam J. Revell, Assistant Professor of Biology > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://blog.phytools.org > > > On 11/26/2013 5:36 PM, Agus Camacho wrote: > >> Dear R-sig-phylo users, >> >> Im trygin to use the cool phenogram (Revell's phytools) to plot two graphs >> together. >> The code to do that comes below. >> >> 1. Id like to adjust the margins of the figure and the position of the >> names so I can avoid the names getting cropped by the margins of the >> figure >> 2. id like to save it to tiff and 600ppi, but when i try using tiff(), as >> i >> do for other graphs, but the figure gets totally deformed. The export >> option also does not allow to set resolution. >> >> Thanks Liam for your recent info. I decided to post this to the list so >> others migth also give a hint. >> Cheers >> Agus >> >> #tree for plotting >> tree <- read.tree(text=" >> ((((C.leiolepis:0.0168, C.nicterus:0.0099):0.0242 >> ,C.sinebrachiatus:0.024):0.0724 >> ,(S.catimbau:0.0652,N.ablephara:0.0309):0.0648):0.0659 >> ,((((P.erythrocercus:0.0235,P. >> tetradactylus:0.0259):0.0462 >> ,V.rubricauda:0.072):0.142 >> ,M.maximiliani:0.1463):0.0225 >> ,P.paeminosus:0.1093):0.0131);") >> tree$tip.label<-gsub("\\.","\\. ",tree$tip.label) >> >> # first create plotting area >> tiff("tp&ctmax.tif",width=5.5, height=7, unit="cm", res=600, >> compression="lzw") >> plot.new(); par(mar=c(2.5,4,0,2)) >> par(mfrow=c(2,1)) >> par(usr=c(-0.04,1.04,-5,1.04*length(tree$tip.label))) >> >> source('C:/Users/Agus/Desktop/Curso de analise compartiva em >> R/phenogram.R') >> # first paint tree >> tree<-paintSubTree(tree,node=16,state="2",stem=T) >> cols<-setNames(c("blue","red"),1:2) >> # define variable and names >> tp=seq(1:10) >> names(tp)=tree$tip.label >> # plot >> phenogram(tree,tp, >> xlab="", >> ylab="preferred temperature (ºC)", >> colors=cols, >> ftype="i", >> spread.labels=TRUE, >> spread.cost=c(1,0.4), >> link=0.2,offset=0, >> ) >> # first paint tree >> tree<-paintSubTree(tree,node=16,state="2",stem=T) >> cols<-setNames(c("blue","red"),1:2) >> # define variables >> ctmax=seq(1:10) >> names(ctmax)=tree$tip.label >> phenogram(tree,ctmax, >> xlab="branch length ", >> ylab="CTMAX (ºC)", >> colors=cols, >> ftype="i", >> spread.labels=TRUE, >> spread.cost=c(1,0.4), >> link=0.2,offset=0, >> ) >> cols<-setNames(c("blue","red"),c("snake-like", "lacertoid")) >> dev.off() >> >> >> >> _______________________________________________ >> R-sig-phylo mailing list - R-sig-phylo@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo >> Searchable archive at http://www.mail-archive.com/r- >> sig-ph...@r-project.org/ >> >> -- Agustín Camacho Guerrero. Doutor em Zoologia. Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP. Rua do Matão, trav. 14, nº 321, Cidade Universitária, São Paulo - SP, CEP: 05508-090, Brasil. [[alternative HTML version deleted]]
_______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/