Friday, October 14, 2011

New food web dataset

Recology has moved, go to http://recology.info/2011/10/new-food-web-dataset



So, there is a new food web dataset out that was put in Ecological Archives here, and I thought I would play with it. The food web is from Otago Harbour, an intertidal mudflat ecosystem in New Zealand. The web contains 180 nodes, with 1,924 links.

Fun stuff...

igraph, default layout plot

igraph, circle layout plot, nice

My funky little gggraph function plot
get the gggraph function, and make it better, here at Github




# Blog post about a new food web
> require(ggplot2); require(igraph); require(bipartite); require(NetIndices)
# read in edge list
> mygraph <- read.graph("/Mac/R_stuff/Blog_etc/newfoodweb/edgelist_new.txt",
+ format = "edgelist")
> str(mygraph)
List of 9
$ : num 181
$ : logi TRUE
$ : num [1:1924] 4 4 4 5 5 5 5 5 5 5 ...
$ : num [1:1924] 1 4 6 1 2 3 4 5 6 12 ...
$ : num [1:1924] 0 1 2 1812 1813 ...
$ : num [1:1924] 0 3 61 142 184 186 404 407 413 415 ...
$ : num [1:182] 0 0 0 0 0 13 61 61 109 126 ...
$ : num [1:182] 0 0 21 91 114 120 158 220 220 220 ...
$ :List of 4
..$ : num [1:2] 1 0
..$ : Named list()
..$ : list()
..$ : list()
- attr(*, "class")= chr "igraph"
# igraph graphs
> plot.igraph(as.undirected(mygraph),
+ vertex.label = NA,
+ vertex.size = 1)
> plot.igraph(as.undirected(mygraph),
+ layout = layout.circle,
+ vertex.label = NA,
+ vertex.size = 1)
# my own little function, gggraph
> source("/Mac/R_stuff/Blog_etc/newfoodweb/gggraph.R")
> gggraph(mygraph, vplace = rnorm, method = "igraph", trophic = "FALSE")
view raw newfoodwb.R hosted with ❤ by GitHub

No comments:

Post a Comment