# Viewing a bipartite network

**Timothée Poisot » R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I published two functions to visualize trophic networks with three or n levels, although most of my work consists in dealing with two-mode (bipartite) networks. The R library bipartite provides two functions to visualize such webs (`plotweb`

and `visweb`

), and I am generally happy with the results of the latter. However, I sometimes find it difficult to use at it seems to require link intensity to be given as integers, and I never have this information. Even if it is easy to do something like

it is not really satisfactory.

There are also some other minor things with the bipartite package (namely, it requires the matrix to be entered « the wrong way », i.e. with the columns where one should expect to find the rows) and the graphical output of this particular function that make me uncomfortable using it.

I wrote a very short piece of R code that uses lines from the original function (to be exhaustive : the calculation of the margin size, and the sorting of the matrix to give it an ecological meaning), and obtained the following output quite easily:

I quite like the look of this, and I think that it is really easier to follow who interacts with who by just « sliding » along the grey lines.

You can get the R code here.

**leave a comment**for the author, please follow the link and comment on their blog:

**Timothée Poisot » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.