Data visualization (in R)

Drawing a trophic network (part 2)

Posted in Ecology by Timothée on July 6, 2010

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.

Advertisements
Tagged with:

Draw a trophic network with n levels

Posted in Ecology by Timothée on July 6, 2010

I published a short function to draw trophic networks with several levels, with links going from level n+1 to level n only. It will only be of interest for people working in ecology (but if you see another possible use, please let me know).

It is available here – with examples.

If I continue to publish at this rhythm, expect a brand new post around november!

Tagged with: