Drawing a trophic network (part 2)

July 6, 2010
By

(This article was first published on Data visualization (in R), and kindly contributed to R-bloggers)

Following discussion on the comments of the previous post, I thought about how it was possible to draw links going in several directions (i.e. there are no ‘clear’ differences between the levels, and species from level n can interact with species of level n, n+1, n-1, n±k, etc).

This is now done, with a code that is as inelegant as humanly possible. Also, the way to lay the different nodes on the graph (i.e. their ‘trophic level’) should be calculated with a proper method, but (i) I am not a specialist of these metrics, and (ii) it is way too late to do any decent bibliographical research to look them up.

The procedure I use here is quite horrible. I randomly reorder the matrix, and compute the trophic position by elevating each species whenever it eats another species. I repeat this a couple time, and then average the trophic position for each species. The x position is a simple random value, which means that you will probably need to do the launch the code a couple times to get a decent looking network.

The R code can be downloaded here.


To leave a comment for the author, please follow the link and comment on his blog: Data visualization (in R).

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.