Skip to content

Commit e70476b

Browse files
committed
Major update
Several changes, shorter and faster code, new figures.
1 parent 8138950 commit e70476b

17 files changed

+487
-623
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22
.Rhistory
33
.DS_Store
4+
README.html
5+
README.html

README.html

Lines changed: 0 additions & 433 deletions
This file was deleted.

README.md

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,94 @@
1-
# How to draw networks in R
1+
# network-drawing
2+
3+
Script with different ways to draw monolayer and multilayer networks in R.
24

35
[Ecological Synthesis Lab](https://marcomellolab.wordpress.com) (SintECO).
46

5-
Author: Marco Mello & Renata Muylaert.
7+
Authors: Marco Mello & Renata Muylaert.
68

79
810

9-
How to cite: Mello MAR. 2017. How to draw networks in R. Ecological Synthesis Lab of the University of São Paulo, Brazil.
10-
11-
Published first on April 25th, 2017 (English version).
12-
13-
Updated on September 18th, 2020 (English version).
11+
First published on April 25th, 2017 (English version).
1412

1513
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4036687.svg)](https://doi.org/10.5281/zenodo.4036687)
1614

1715
Run in R version 4.0.2 (2020-06-22) -- "Taking Off Again".
1816

19-
Disclaimer: You may use this script freely for any purpose at your own risk. We assume no responsibility or liability for the use of this software, convey no license or title under any patent, copyright, or mask work right to the product. We reserve the right to make changes in the software without notification. We also make no representation or warranty that such application will be suitable for the specified use without further testing or modification. If this script helps you produce any academic work (paper, book, chapter, dissertation etc.), please acknowledge the authors and cite the source, using the DOI provided and the URL to this GitHub repository.
17+
Disclaimer: You may use this software freely for any purposes at your own risk. We assume no responsibility or liability for the use of this software, convey no license or title under any patent, copyright, or mask work right to the product. We reserve the right to make changes in the software without notification. We also make no representation or warranty that such application will be suitable for the specified use without further testing or modification. If this software helps you produce any academic work (paper, book, chapter, dissertation, report, talk, lecture or similar), please acknowledge the authors and cite the source, using this repo's DOI or URL.
18+
19+
20+
## List of folders and files
21+
22+
1. data (folder)
23+
24+
a. net1.txt -> interactions of pollination between oil-collecting bees and oil flowers (Bezerra et al. 2009).
25+
26+
b. net2.txt -> interactions of pollination between bats, hawkmoths, and plants (Queioz et al. 2020).
27+
28+
c. net3an.txt -> interactions of seed destruction (antagonism) between maruspials, rodents, and plants (Genrich et al. 2017).
29+
30+
d. net3mu.txt -> interactions of seed dispersal (mutualism) between maruspials, rodents, and plants (Genrich et al. 2017).
31+
32+
33+
2. figures (folder)
34+
35+
a. net1_bipartite_graph.png -> monolayer network drawn as a bipartite graph.
36+
37+
b. net1_bipartite_matrix.png -> monolayer network drawn as an incidence matrix.
38+
39+
c. net1_igraph_graph_multi.png -> multilayer network drawn as an energy-minimization graph, with node colors by taxonomic group.
40+
41+
d. net1_igraph_graph_taxon.png -> monolayer network drawn as an energy-minimization graph, with node colors by taxonomic group.
42+
43+
e. net1_igraph_graph.png -> monolayer network drawn as an energy-minimization graph.
44+
45+
46+
3. network-drawing.pdf -> tutorial in PDF format.
47+
48+
4. network-drawing.R -> script with commented codes.
49+
50+
5. network-drawing.Rmd -> tutorial in RMD format.
51+
52+
53+
## Data sources
54+
55+
1. net1 -> Bezerra, E. L. S., Machado, I. C., & Mello, M. A. R. (2009). [Pollination networks of oil-flowers: a tiny world within the smallest of all worlds](https://doi.org/10.1111/j.1365-2656.2009.01567.x). Journal of Animal Ecology, 78(5), 1096–1101.
56+
57+
2. net2 -> Queiroz, J. A., Diniz, U. M., Vázquez, D. P., Quirino, Z. M., Santos, F. A. R., Mello, M. A. R., & Machado, I. C. (2020). Bats and hawkmoths form mixed modules with flowering plants in a nocturnal interaction network. Biotropica, *accepted*. See also this [repo](https://github.com/marmello77/queiroz-et-al-2020).
58+
59+
3. net3an and net3mu -> Genrich, C. M., Mello, M. A. R., Silveira, F. A. O., Bronstein, J. L., & Paglia, A. P. (2017). [Duality of interaction outcomes in a plant-frugivore multilayer network](https://doi.org/10.1111/oik.03825). Oikos, 126(3), 361–368. doi: 10.1111/oik.03825
60+
2061

2162
## Instructions
2263

23-
If you are familiar with R, just run the scripts provided in the R file.
64+
If you are familiar with R, just run the scripts provided in "network-drawing.R".
65+
66+
If you are not so familiar with R, follow the steps described in the RMD tutorial.
67+
68+
If you just to take a look at the networks and their drawing solutions, read the PDF tutorial.
69+
70+
71+
## Feedback
72+
73+
If you have any questions, corrections, or suggestions, please feel free to open and [issue](https://github.com/marmello77/network-drawing/issues) or make a [pull request](https://github.com/marmello77/network-drawing/pulls).
74+
75+
76+
## Acknowledgments
77+
78+
We thank our labmates and our sponsors, especially the Alexander von Humboldt-Stiftung, CNPq, CAPES, and FAPESP, who gave us grants, fellowships, and scholarships. Pedro Jordano and Carsten Dormann helped us take our first steps in analyzing and drawing networks in R. Special thanks go to Katherine Ognyanova, who gave us invaluable tips on advanced network drawing in R. We strongly recommend her [online tutorial](http://kateto.net/network-visualization). Last, but not least, we thank the [Stack Overflow Community](https://stackoverflow.com), where we solve most of our coding dilemmas.
79+
80+
81+
## Suggested readings
82+
83+
* Ognyanova K. 2019. [Static and dynamic network visualization with R](http://kateto.net/network-visualization).
84+
85+
* Pocock, M. J. O., D. M. Evans, C. Fontaine, M. Harvey, R. Julliard, Ó. McLaughlin, J. Silvertown, A. Tamaddoni-Nezhad, P. C. L. White, and D. A. Bohan. (2016) [The Visualisation of Ecological Networks, and Their Use as a Tool for Engagement, Advocacy and Management](http://linkinghub.elsevier.com/retrieve/pii/S0065250415000355). In G. Woodward and D. A. Bohan (Eds.) Advances in Ecological Research. pp. 41–85, Academic Press, Cambridge.
86+
87+
* Marai, G. E., B. Pinaud, K. Bühler, A. Lex, and J. H. Morris. (2019) [Ten simple rules to create biological network figures for communication](https://doi.org/10.1371/journal.pcbi.1007244). PLOS Comput. Biol. 15: e1007244.
88+
89+
* Mello MAR, Muylaert RL, Pinheiro RBP & Félix GMF. 2016. [Guia para análise de redes ecológicas](https://marcomellolab.wordpress.com/software/). Edição dos autores, Belo Horizonte. 112 p. ISBN-13: 978-85-921757-0-2.
90+
91+
* Barabasi, A.L. (2016) [Network Science](http://barabasi.com/networksciencebook/), 1st ed. Cambridge University Press, Cambridge.
2492

25-
If you are not so familiar with R, follow the steps described in the RMD file.
93+
* Bascompte, J. & Jordano, P. (2014) [Mutualistic Networks](https://amzn.to/2FLwhto), 1st ed. Princeton University Press, Princeton.
2694

27-
If you have any questions, corrections, or suggestions, please feel free to open and *issue* or make a *pull request*.

data/net1.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Cenaen Cenfus Cencax Centar Cenfla Centri Cenobs Episp2 Apimel Censp3 Censp1 Xylsp Xylgri
2+
Dippub 1368 1364 740 460 416 256 0 328 364 368 0 0 0
3+
Byrgar 924 320 2108 464 284 0 0 0 28 0 0 0 0
4+
Banmur 396 468 108 140 272 652 912 364 44 0 368 164 84
5+
Hetsp1 764 680 528 308 404 300 0 28 0 0 0 76 0
6+
Hetsp2 740 656 528 332 0 324 0 116 116 0 0 0 0
7+
Dicbra 556 512 356 132 524 0 0 0 0 0 0 0 0
8+
Carcha 604 452 432 200 0 0 0 0 0 0 0 0 0
9+
Stipar 504 816 0 0 0 0 0 0 0 0 0 0 0
10+
Banste 292 300 244 116 0 0 0 0 0 0 0 0 0
11+
Bansch 228 224 124 120 0 0 0 0 0 0 0 0 0
12+
Stiaur 240 164 68 0 196 0 0 0 0 0 0 0 0
13+
Sticil 268 196 0 0 164 0 0 0 0 0 0 0 0
14+
Janani 188 244 0 96 0 0 0 0 0 0 0 0 0

data/net2.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Pilgou Encspe Gueang Bauche Helbar Pilchr Psemar Ambcea Asppyr Ipomar Lirsp Crosp Ceigla Tocfor Cerjam Comsp Pipsti Ind1 Allsp Anacol Caesp Schbra Alisp Ind2
2+
Glosor 23 22 0 10 34 27 24 0 0 8 24 4 4 0 0 0 2 0 0 0 0 0 0 0
3+
L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 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ByrSp CamAda CecHol CecPac CecGla ChiAlb CocAur ErytSp EuphSp FicuSp LeaAur LeaCor LeanSp MicAlb MicLig MicPep MicSp1 MorSp1 MorSp2 MorSp3 MorSp5 MorSp6 MorSp7 MorSp8 MorSp9 MyrSp1 MyrSp2 PsidSp RubSp1 RubSp2 SabBra SolaSp TocFor VisBra
2+
CerSco 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3+
CerSub 0 0 0 13 12 0 19 0 0 0 3 0 1 0 0 2 0 0 0 0 0 0 0 72 9 0 0 0 0 0 11 0 0 0
4+
DidAlb 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 5 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0
5+
DidAur 0 0 0 6 11 0 0 1 3 2 0 0 0 1 50 0 0 0 1 2 0 1 19 0 0 2 2 0 0 0 0 0 0 3
6+
MonDom 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
7+
NecLas 0 20 0 0 0 3 0 0 0 0 15 4 2 0 0 0 0 0 0 0 0 0 0 10 58 0 9 18 0 0 0 2 0 0
8+
OliSp 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9+
PhiFre 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
10+
GueIng 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

data/net3mu.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ByrSp CamAda CecHol CecPac CecGla ChiAlb CocAur ErytSp EuphSp FicuSp LeaAur LeaCor LeanSp MicAlb MicLig MicPep MicSp1 MorSp1 MorSp2 MorSp3 MorSp5 MorSp6 MorSp7 MorSp8 MorSp9 MyrSp1 MyrSp2 PsidSp RubSp1 RubSp2 SabBra SolaSp TocFor VisBra
2+
CerSco 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3+
CerSub 0 0 0 9 3 0 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0
4+
DidAlb 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0
5+
DidAur 0 0 0 12 4 0 1 6 8 0 0 0 0 0 5 0 0 0 0 0 0 0 36 0 0 0 7 0 0 0 0 0 0 0
6+
MonDom 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0
7+
NecLas 0 1 0 0 0 1 0 0 0 0 12 2 0 0 0 0 0 0 0 0 0 0 0 0 62 0 1 24 0 0 0 5 0 0
8+
OliSp 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
9+
PhiFre 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
10+
GueIng 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

figures/net1_bipartite_graph.png

752 KB
Loading

figures/net1_bipartite_matrix.png

304 KB
Loading

figures/net1_igraph_graph.png

568 KB
Loading

0 commit comments

Comments
 (0)