-
Notifications
You must be signed in to change notification settings - Fork 3
/
the-promise-to-partner.r
418 lines (369 loc) · 15 KB
/
the-promise-to-partner.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
if (!require("igraph")) install.packages("igraph")
library("igraph")
# https://gist.github.com/LukasCBossert/9bd04115db3aa9ed974fdc69d3ff227c
NFDI_edges <- read.table(header=TRUE,
sep=",",
text="
from,to
DataPLANT,NFDI4BioDiversity
DataPLANT,NFDI4Chem
GHGA,NFDI4Health
KonsortSWD,BERD@NFDI
KonsortSWD,NFDI4BioDiversity
KonsortSWD,NFDI4Earth
KonsortSWD,NFDI4Health
KonsortSWD,Text+
NFDI4BioDiversity,NFDI4Earth
NFDI4BioDiversity,NFDI4Chem
NFDI4BioDiversity,NFDI4Health
NFDI4BioDiversity,KonsortSWD
NFDI4BioDiversity,DataPLANT
NFDI4Cat,FAIRmat
NFDI4Cat,NFDI4Chem
NFDI4Cat,NFDI4Ing
NFDI4Cat,DAPHNE4NFDI
NFDI4Chem,FAIRmat
NFDI4Chem,NFDI4Ing
NFDI4Chem,NFDI4Cat
NFDI4Chem,DAPHNE4NFDI
NFDI4Chem,PUNCH4NFDI
NFDI4Chem,NFDI4Health
NFDI4Chem,NFDI4BioDiversity
NFDI4Culture,Text+
NFDI4Culture,MaRDI
NFDI4Culture,NFDI4Ing
NFDI4Health,GHGA
NFDI4Health,KonsortSWD
NFDI4Health,NFDI4Chem
NFDI4Health,NFDI4Earth
NFDI4Health,NFDI4BioDiversity
NFDI4Ing,NFDI-MatWerk
NFDI4Ing,FAIRmat
NFDI4Ing,NFDI4Chem
NFDI4Ing,NFDI4Earth
NFDI4Ing,MaRDI
NFDI4Ing,Text+
NFDI4Ing,NFDI4Culture
BERD@NFDI,KonsortSWD
BERD@NFDI,MaRDI
BERD@NFDI,Text+
DAPHNE4NFDI,FAIRmat
DAPHNE4NFDI,NFDI-MatWerk
DAPHNE4NFDI,NFDI4Cat
DAPHNE4NFDI,NFDI4Chem
DAPHNE4NFDI,NFDI4Health
DAPHNE4NFDI,NFDI4Ing
DAPHNE4NFDI,PUNCH4NFDI
FAIRmat,DAPHNE4NFDI
FAIRmat,DataPLANT
FAIRmat,MaRDI
FAIRmat,NFDI-MatWerk
FAIRmat,NFDI4Cat
FAIRmat,NFDI4Chem
FAIRmat,NFDI4DataScience
FAIRmat,NFDI4Ing
FAIRmat,PUNCH4NFDI
MaRDI,BERD@NFDI
MaRDI,FAIRmat
MaRDI,NFDI-MatWerk
MaRDI,NFDI4Cat
MaRDI,NFDI4Chem
MaRDI,NFDI4Ing
MaRDI,PUNCH4NFDI
NFDI-MatWerk,DAPHNE4NFDI
NFDI-MatWerk,DataPLANT
NFDI-MatWerk,FAIRmat
NFDI-MatWerk,MaRDI
NFDI-MatWerk,NFDI4Chem
NFDI-MatWerk,NFDI4DataScience
NFDI-MatWerk,NFDI4Ing
NFDI4DataScience,KonsortSWD
NFDI4DataScience,MaRDI
NFDI4DataScience,NFDI-MatWerk
NFDI4DataScience,NFDI4BioDiversity
NFDI4DataScience,NFDI4Cat
NFDI4DataScience,NFDI4Chem
NFDI4DataScience,NFDI4Culture
NFDI4DataScience,NFDI4Health
NFDI4DataScience,NFDI4Ing
NFDI4DataScience,NFDI4Microbiota
NFDI4Earth,DataPLANT
NFDI4Earth,GHGA
NFDI4Earth,KonsortSWD
NFDI4Earth,NFDI4BioDiversity
NFDI4Earth,NFDI4Cat
NFDI4Earth,NFDI4Chem
NFDI4Earth,NFDI4Culture
NFDI4Earth,NFDI4Health
NFDI4Earth,NFDI4Ing
NFDI4Microbiota,DataPLANT
NFDI4Microbiota,GHGA
NFDI4Microbiota,NFDI4BioDiversity
NFDI4Microbiota,NFDI4Chem
NFDI4Microbiota,NFDI4DataScience
NFDI4Microbiota,NFDI4Health
NFDI4Microbiota,NFDI4Ing
PUNCH4NFDI,DAPHNE4NFDI
PUNCH4NFDI,FAIRmat
PUNCH4NFDI,GHGA
PUNCH4NFDI,MaRDI
PUNCH4NFDI,NFDI4Earth
PUNCH4NFDI,NFDI4Ing
Text+,KonsortSWD
Text+,NFDI4BioDiversity
Text+,NFDI4Culture
Text+,NFDI4Earth
Text+,NFDI4Ing
")
head(NFDI_edges)
NFDI_network <- graph_from_data_frame(NFDI_edges,
directed = FALSE
)
head(NFDI_network)
set.seed(9876543)
plot(NFDI_network, # loading data frame
main = "NFDI Network", # adding a title
frame = TRUE # making a frame
)
set.seed(9876543)
plot(NFDI_network, # loading data frame
main = "NFDI Network", # adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, #* better layout options
)
set.seed(9876543)
plot(NFDI_network, # loading data frame
main = "NFDI Network", # adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = "#ffcc66", #* color of nodes
vertex.frame.color = "#ffcc66", #* color of the frame of nodes
vertex.label.cex = 0.5, #* size of the description of the labels
vertex.label.color = "black", #* color of the description
edge.color = "#808080", #* color of edges
edge.curved = 0.1, #* factor of "curvity"
)
#data.frame(
degree(NFDI_network) #* calculate number of edges
#)
set.seed(9876543)
plot(NFDI_network, # loading data frame
main = "NFDI-Netzwerk", # adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = "#ffcc66", # color of nodes
vertex.frame.color = "#ffcc66", # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0.1, # factor of "curvity"
vertex.size = degree(NFDI_network), #* size of nodes depends on amount of edges
)
NFDI_network_directed <- graph_from_data_frame(NFDI_edges,
directed = TRUE
)
head(NFDI_network_directed)
set.seed(9876543)
plot(NFDI_network_directed, #<<<<<<< loading data frame
main = "NFDI-Netzwerk", # adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = "#ffcc66", # color of nodes
vertex.frame.color = "#ffcc66", # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, #<<<<<<<<< factor of "curvity"
vertex.size = degree(NFDI_network_directed), #<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, #* arrow size, defaults to 1
)
#data.frame(
degree(NFDI_network_directed,
mode = "in")
#)
set.seed(9876543)
plot(NFDI_network_directed, # loading data frame
main = "NFDI Network (<in>)", #<<<<<<<< adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = "#ffcc66", # color of nodes
vertex.frame.color = "#ffcc66", # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "in"), #<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
)
#data.frame(
degree(NFDI_network_directed,
mode = "out")
#)
set.seed(9876543)
plot(NFDI_network_directed, # loading data frame
main = "NFDI Network (<out>)", #<<<<<<<< adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = "#ffcc66", # color of nodes
vertex.frame.color = "#ffcc66", # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "out"), #<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
)
# https://gist.github.com/LukasCBossert/ce56ebd0059b4879c7d11c1090118c25
NFDI_nodes <- read.table(header=TRUE,
sep=",",
text="
name,group,round
DataPLANT,2,1
GHGA,1,1
KonsortSWD,3,1
NFDI4BioDiversity,2,1
NFDI4Cat,5,1
NFDI4Chem,5,1
NFDI4Culture,3,1
NFDI4Health,1,1
NFDI4Ing,4,1
BERD@NFDI,3,2
DAPHNE4NFDI,5,2
FAIRmat,5,2
MaRDI,4,2
NFDI-MatWerk,4,2
NFDI4DataScience,4,2
NFDI4Earth,2,2
NFDI4Microbiota,2,2
PUNCH4NFDI,5,2
Text+,3,2
")
NFDI_network_directed <- graph_from_data_frame(d = NFDI_edges, # d = data frame =~ edges
vertices = NFDI_nodes, #nodes
directed = TRUE) #directed
NFDI_color_year <- c("lightgreen", # 2019 (1)
"lightblue" # 2020 (2)
)
NFDI_color_groups <- NFDI_color_year[
as.numeric(as.factor(
V(NFDI_network_directed)$round))] # <<<< based on the round
set.seed(9876543)
plot(NFDI_network_directed, # loading data frame
main = "NFDI-Network (<Funding year>)", #<<<<<<<< adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = NFDI_color_groups, #<<<<<<<<<< color of nodes
vertex.frame.color = NFDI_color_groups, #<<<<<<<<<< color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "total"), #<<<<<<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
)
NFDI_color_code <- c("#f5ac9f", # Medicine
"#e43516", # Life Sciences
"#f9b900", # Humanities
"#007aaf", # Engineering Sciences
"#6ca11d" # Chemistry/Physics
)
NFDI_color_groups <- NFDI_color_code[
as.numeric(as.factor(
V(NFDI_network_directed)$group))]
set.seed(9876543)
plot(NFDI_network_directed, # loading data frame
main = "NFDI-Network (<NFDI conference systematics>)", #<<<<<<<< adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = NFDI_color_groups, #<<<<<<<<<< color of nodes
vertex.frame.color = NFDI_color_groups, #<<<<<<<<<< color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "total"), #<<<<<<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
)
nfdi_plot_legend <- function(){
legend("topleft", # x-position
title = "NFDI conference systematics", # title
legend = c(
"(1) Medicine",
"(2) Life Sciences",
"(3) Humanities",
"(4) Engineering Sciences",
"(5) Chemistry/Physics"
), # the text of the legend
col = NFDI_color_code , # colors of lines and points beside the legend text
pch = 20, # the plotting symbols appearing in the legend
bty = "n", # no frame, the type of box to be drawn around the legend (n=no frame)
cex = .75, # character expansion factor relative to current par("cex").
pt.cex = 2 # expansion factor(s) for the points
)
}
set.seed(9876543)
plot(NFDI_network_directed, # loading data frame
main = "NFDI Network (<NFDI conference systematics>)", #<<<<<<<< adding a title
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = NFDI_color_groups, # color of nodes
vertex.frame.color = NFDI_color_groups, # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.color = "#808080", # color of edges
edge.curved = 0, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "total"), #<<<<<<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
)
nfdi_plot_legend()
nfdi_plot_group <- function(NFDI_name) {
set.seed(9876543)
nfdi_local_network <- function(NFDI_name) {
plot(NFDI_network_directed,
main = "NFDI Network (<NFDI conference systematics>)", # adding a title
sub = NFDI_name,
frame = TRUE, # making a frame
layout = layout.graphopt, # better layout options
vertex.color = NFDI_color_groups, # color of nodes
vertex.frame.color = NFDI_color_groups, # color of the frame of nodes
vertex.label.cex = 0.5, # size of the description of the labels
vertex.label.color = "black", # color of the description
# color: https://www.w3schools.com/colors/colors_picker.asp
edge.curved = 0.2, # factor of "curvity"
vertex.size = degree(NFDI_network_directed,
mode = "total"), #<<<<<<<<<<< size of nodes depends on amount of edges
edge.arrow.size = .5, # arrow size, defaults to 1
edge.color = with(NFDI_edges,
ifelse(from %in% NFDI_name,"#808080", # grey
ifelse(to == NFDI_name,"#000000", # black
NA)))
)
nfdi_plot_legend()
}
####################################################
### ! important!
### If you want to export the plots,
### you need to create a folder called "img" first.
####################################################
# pdf(paste0("img/network_group_",NFDI_name,".pdf")) # save image as PDF
# nfdi_local_network(NFDI_name) # display image for saving
# dev.off() # close image stream
nfdi_local_network(NFDI_name) # display image in JupyterNotebook
}
nfdi_plot_group("NFDI4Ing")
nfdi_plot_group("NFDI4Microbiota")
for (name in NFDI_nodes$name){
nfdi_plot_group(name)
}