Hello.
I was using the package ipgraph to plot networks of parasites and hosts.
Then i though about plug a phylogeny tree on the plot. But I'm having some
difficulties to do so.

I'll give and CMR , hope someone can help.

#I have data that look like this, 6 parasites ("P") and six host species
("P")
dados<-matrix(c(1,1,1,1,0,0,
                0,1,1,1,0,0,
                0,0,1,1,0,0,
                0,0,0,0,1,0,
                0,0,0,0,0,1,
                0,0,0,0,0,1),byrow=T,ncol=6,nrow=6,
                dimnames=list(paste("P",1:6,sep=""),paste("H",1:6,sep="")))
dados

#Then i convert the data a way i can use with igraph packages
#Is there a more elegant way to change data like this anyway?

library(igraph)
dados.network<-cbind(expand.grid(rownames(dados),colnames(dados)),Presence=c(dados[,]))
dados.network<-dados.network[which(dados.network$Presence==1),1:2]
dados.igraph<-graph.data.frame(dados.network)

plot(dados.igraph,layout=layout.fruchterman.reingold,
vertex.color=c(rep("red",6),rep("green",6)),edge.arrow.size=0.2,vertex.size=20,
vertex.label=c(paste("P",1:6,sep=""),paste("H",1:6,sep="")))

#now i would like to combine 2 plots,
#one phylogenetic tree of the hosts:

library(ape)
host.tree<-rtree(6,rooted=TRUE,tip.label=paste("H",1:6,sep=""))

#with the netwrok, but the network would have to had  a layout like in
package bipartite
library(bipartite)

#something like this
par(mfrow=c(2,1))
plot(host.tree,use.edge.length=F,direction="downwards")
plotweb(dados)


Althoguht plotweb() do what i would like, in a pretty beautiful graph, i
could not make it do equidistant representation  for the host species, nor
reproduce this layout with igraph.
If i could reproduce the layout on plot.igraph(), i think it would be easy
to plug the tree on the network.
So anyone know if there is an easy way to do what i'm trying? I'm pretty
stuck here

Thanks for your attention.

Best wishes
Augusto Ribas


-- 
Grato
Augusto C. A. Ribas

Site Pessoal: http://augustoribas.heliohost.org
Lattes: http://lattes.cnpq.br/7355685961127056

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to