# cheddar (Hudson et al., 2013) install.packages("cheddar") library(cheddar) parasitoid<-c("Bracon1","Bracon1","Bracon1","Bracon1","Bracon1", "agathidine1","agathidine1","agathidine1","agathidine1","Cotesia1", "Cotesia1","Cotesia1","Cotesia1","Cotesia2","Cotesia3","Cotesia3","Cotesia3", "Cotesia4","Aleiodes1","Aleiodes2","Macrocentrus1") host<-c("Nymphalidae2","Erebidae1","Erebidae1","Erebidae1","Erebidae1", "Erebidae2","Erebidae2","Noctuid1","Lycaenidae1","Hesperidae1", "Hesperidae1","Hesperidae1","Hesperidae2","Noctuidae2","Geometridae1", "Geometridae2","Erebidae1","Erebidae1","Erebidae1","Erebidae3", "Erebidae4") properties<-data.frame(title="ThaiWasps") # properties nodes<-data.frame(node=unique(c(host,parasitoid)),type= c(rep("host", length(unique(host))),rep("parasitoid",length(unique(parasitoid)))),colour=c(rep ("green", length(unique(host))),rep("red",length(unique(parasitoid))))) # head(nodes) all.records<-as.data.frame(cbind(host,parasitoid)) unique.links<-as.data.frame(unique(all.records)) # head(unique.links) hp_pairs<- paste(all.records$host,all.records$parasitoid) # hp_pairs weight<-as.vector(table(hp_pairs)) # using as.vector just gives us the numbers # weight unique.links$weight<-weight colnames(unique.links) <- c("resource","consumer","weight") thaiFW<-list(nodes, properties, unique.links) names(thaiFW) <- c("nodes","properties","trophic.links") attr(thaiFW, "class") <- c("Community","list") windows(11,4) #### this is the bit i want you to test, it should make your graphics window wide par(mfrow=c(1,3)) PlotCircularWeb(thaiFW,show.nodes.as="labels", node.labels="node", col=NPS(thaiFW)$colour, main="Thai host-parasitoid food web",xpd=NA) PlotCircularWeb(thaiFW,show.nodes.as="labels", node.labels="node", col=NPS(thaiFW)$colour, link.lwd=TLPS(thaiFW)$weight, main="Thai host-parasitoid food web",xpd=NA) PlotWebByLevel(thaiFW, pch=21, bg=NPS(thaiFW)$colour, link.lwd=TLPS(thaiFW)$weight, main="Thai host-parasitoid food web",xpd=NA)