Hello.
I was using the package ipgraph to plot networks of parasites and hosts in
R. Then i though about plug a phylogeny tree on the plot. But I'm having
some difficulties to do so.
#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)
#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 network, but the network would have to had a layout like in
package bipartite
library(bipartite)
#Take the order of the hosts from the tree
order<-host.tree$tip.lab
par(mfrow=c(2,1))
#remove the host names from the tree to not repeat the network
plot(host.tree,use.edge.
length=F,direction="downwards",show.tip.label =F)
#now plot the network, with the order of the tree
plotweb(dados[,order],method = "normal")
#but i would like to make this:
#something like this draw:
http://oi47.tinypic.com/2j2szcy.jpg
so instead the plotweb for the network plot, i would like to use
plot.igraph()
But is there some simple way, like a layout that would make it?
Hope i'm not confuseing everything.
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help