Skip to content

Instantly share code, notes, and snippets.

@ikashnitsky
Last active November 3, 2023 15:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ikashnitsky/90483ee3c3c230aa874dffb856d6074b to your computer and use it in GitHub Desktop.
Save ikashnitsky/90483ee3c3c230aa874dffb856d6074b to your computer and use it in GitHub Desktop.
Map the country data of Publons (data from https://publons.com/country, manual export on 2021-01-07) – https://twitter.com/ikashnitsky/status/1347325289496502272
#===============================================================================
# 2021-01-07 -- twitter
# Visualize Publons country data
# https://publons.com/country
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#===============================================================================
library(tidyverse)
library(magrittr)
library(sf)
library(spData)
library(rmapshaper)
library(countrycode)
library(ggdark)
library(hrbrthemes)
library(showtext)
library(cowplot)
# manually exported data (on 2021-01-07) deposited as a gist
data_url <- "https://gist.githubusercontent.com/ikashnitsky/90483ee3c3c230aa874dffb856d6074b/raw/65173975b0edcaa2f2da38e1e3f4e92e17f62158/publons.txt"
foo <- read_lines(data_url) %>%
matrix(ncol = 7, byrow = T) %>%
as_tibble() %>%
set_colnames(c("rank", "country", "researchers", "top_rev", "verified_rev", "verified_rev_12m", "verified_editor_rec")) %>%
# numerical colums to numeric format
mutate_at(3:7, {function(x) x %>% str_remove_all(",") %>% as.numeric}) %>%
# add ISO codes
mutate(code = country %>% countryname(destination = "iso2c"))
df <- foo %>%
mutate(
rev_per_res = verified_rev / researchers,
rev_per_res_12m = verified_rev_12m / researchers,
)
df %>%
filter(researchers %>% is_weakly_greater_than(10)) %>%
ggplot(aes(rev_per_res, rev_per_res_12m))+
geom_point()
# get world map outline (you might need to install the package)
world_outline <- spData::world %>%
st_as_sf()
# let's use a fancy projection
world_outline_robinson <- world_outline %>%
st_transform(crs = 54030)
# produce borders layer
country_borders <- world_outline_robinson %>%
rmapshaper::ms_innerlines()
# merge the data and borders
df_map <- world_outline_robinson %>%
left_join(df, by = c("iso_a2" = "code")) %>%
filter(researchers %>% is_weakly_greater_than(10))
# map!
df_map %>%
ggplot()+
geom_sf(aes(fill = rev_per_res_12m), color = NA)+
geom_sf(data = country_borders, size = .1, color = "#ffffff")+
scale_fill_viridis_b(option = "B", breaks = c(.5, 1, 1.5, 2))+
dark_theme_minimal(base_family = font_rc)+
theme(
axis.text = element_blank(),
plot.background = element_rect(fill = "#000000", color = NA),
legend.position = c(.15, .4)
)+
labs(
title = "Verified Publons reviews per researcher, last 12 months [2021-01-07]",
caption = "Data: https://publons.com/country | Design: @ikashnitsky",
fill = NULL
)
ggsave("~/Downloads/map-publons.png", width = 7, height = 4)
# try biscale map ---------------------------------------------------------
library(biscale)
df_bi <- df %>%
filter(researchers %>% is_weakly_greater_than(10)) %>%
select(code, researchers, rev_per_res_12m) %>%
drop_na() %>% # needed for categorizing in 9 classes
bi_class(
x = researchers, y = rev_per_res_12m,
style = "quantile", dim = 3
) %>%
right_join(world_outline_robinson, by = c("code" = "iso_a2"))
df_bi_map <- world_outline_robinson %>%
left_join(df_bi) %>%
filter(researchers %>% is_weakly_greater_than(10))
map <- ggplot(df_bi_map) +
geom_sf(
data = world_outline_robinson %>%
filter(!iso_a2 == "AQ"), # remove Antarctica
fill = "#FFFFFF", color = NA
)+ # for missing countries
geom_sf(
mapping = aes(fill = bi_class),
color = "white", size = 0.1, show.legend = FALSE
) +
bi_scale_fill(pal = "GrPink", dim = 3) +
labs(
title = "Verified Publons reviews per researcher, last 12 months [2021-01-07]",
caption = "Data: https://publons.com/country | Design: @ikashnitsky"
) +
theme_minimal(base_family = font_rc)+
theme(
axis.text = element_blank(),
legend.position = c(.15, .4)
)
legend <- bi_legend(
pal = "GrPink",
dim = 3,
xlab = "# of Researchers ",
ylab = "Reviews per\nResearcher ",
size = 8
)+
theme_minimal(base_family = font_rc)+
theme(
plot.background = element_blank(),
axis.text = element_blank(),
panel.grid = element_blank()
)
(out <- ggdraw(map) +
draw_plot(legend, -.02, .15, 0.35, 0.35))
ggsave("~/Downloads/map-publons-bi.png", out, width = 7, height = 4)
# proportion of top reviewers --------------------------------------------
df_map %>%
mutate(prop_top = top_rev / researchers *100) %>%
ggplot()+
geom_sf(aes(fill = prop_top), color = NA)+
geom_sf(data = country_borders, size = .1, color = "#ffffff")+
scale_fill_viridis_b(option = "B", breaks = 1:5)+
dark_theme_minimal(base_family = font_rc)+
theme(
axis.text = element_blank(),
plot.background = element_rect(fill = "#000000", color = NA),
legend.position = c(.1, .4)
)+
labs(
title = "Proportion of Researchers recognised as Publons Top Reviewers",
caption = "Data: https://publons.com/country | Design: @ikashnitsky",
fill = "%"
)
ggsave("~/Downloads/map-publons-prop-top.png", width = 7, height = 4)
1st
USA
176,592
4,487
1,226,779
264,896
52,616
2nd
Italy
49,383
1,769
462,212
115,501
27,405
3rd
United Kingdom
58,385
1,448
410,211
86,323
35,726
4th
Spain
89,435
1,362
389,392
92,944
26,895
5th
China Mainland
234,458
1,291
449,751
169,922
13,276
6th
Australia
46,442
1,185
324,652
72,790
24,163
7th
Germany
35,232
1,062
251,997
49,942
15,102
8th
India
81,368
1,058
324,994
101,224
10,889
9th
Japan
36,064
774
210,775
49,772
6,898
10th
Portugal
24,075
704
185,369
41,367
15,468
11th
Canada
22,677
635
173,017
38,378
9,290
12th
Brazil
132,035
631
237,522
72,268
12,707
13th
France
32,561
582
157,971
31,771
8,937
14th
Iran
46,079
578
171,248
56,949
4,867
15th
Poland
31,425
454
126,897
45,085
3,918
16th
Turkey
59,564
419
137,221
38,402
5,999
17th
Netherlands
18,879
352
94,439
18,760
7,584
18th
Egypt
16,142
342
98,841
33,193
4,553
19th
Malaysia
25,793
328
97,473
31,356
6,554
20th
Greece
5,826
320
85,917
19,918
3,363
21st
Sweden
11,227
290
87,221
17,333
2,711
22nd
Switzerland
9,545
266
70,013
13,540
3,522
23rd
Romania
14,619
251
69,726
23,959
3,212
24th
New Zealand
5,547
244
58,339
11,095
9,271
25th
Belgium
11,147
241
60,539
12,238
2,901
26th
South Korea
19,866
232
67,906
20,375
2,119
27th
Denmark
9,195
208
52,301
11,419
2,744
28th
Mexico
21,924
194
58,492
15,161
2,705
29th
Taiwan
13,161
188
63,980
19,719
2,605
30th
Czech Republic
23,773
176
53,502
14,939
15,947
31st
Austria
5,608
175
46,845
9,195
3,139
32nd
Iraq
20,179
173
53,121
23,941
1,227
33rd
Hong Kong
8,877
169
47,438
15,512
4,608
34th
Saudi Arabia
11,574
158
40,957
13,006
3,429
35th
Russia
148,491
157
54,331
19,294
2,134
36th
Norway
4,932
140
39,340
8,630
1,863
37th
Pakistan
10,765
140
43,166
15,809
1,831
38th
Finland
6,524
124
39,527
8,472
1,449
39th
Singapore
7,022
122
36,560
11,195
1,809
40th
Ireland
4,626
116
32,602
7,003
1,555
41st
South Africa
7,213
107
35,744
9,103
1,867
42nd
Hungary
7,910
96
27,538
6,652
936
43rd
Serbia
2,828
85
22,434
5,993
1,524
44th
Nigeria
6,437
79
28,168
8,555
1,109
45th
Israel
3,976
77
22,449
4,770
491
46th
Croatia
5,243
68
20,598
6,085
1,179
47th
Chile
8,552
63
20,173
4,720
725
48th
Thailand
5,247
63
19,898
5,268
689
49th
Indonesia
15,262
61
21,757
8,395
4,467
50th
Argentina
3,234
53
17,938
3,557
332
51st
Slovenia
1,690
51
12,718
2,909
1,033
52nd
Slovakia
5,500
47
14,623
5,207
440
53rd
Bulgaria
4,428
44
12,093
3,992
1,709
54th
Algeria
4,462
38
11,800
3,877
357
55th
Bangladesh
3,252
37
12,904
5,011
338
56th
Cyprus
977
37
8,304
2,301
448
57th
Jordan
2,499
36
10,594
3,241
313
58th
Ukraine
43,879
36
11,551
4,252
489
59th
Vietnam
4,182
35
13,440
5,300
931
60th
United Arab Emirates
2,093
34
9,469
2,745
409
61st
Lithuania
1,482
30
9,011
2,896
417
62nd
Morocco
1,957
29
8,104
2,664
476
63rd
Colombia
9,803
29
13,171
3,379
874
64th
Tunisia
2,108
26
8,179
2,255
160
65th
Ghana
1,450
22
8,291
2,214
193
66th
Macau
662
21
5,259
1,819
98
67th
Qatar
711
20
5,782
1,466
291
68th
Estonia
2,054
19
6,025
1,641
511
69th
Lebanon
804
19
7,084
2,109
328
70th
Oman
715
18
6,032
2,084
349
71st
Luxembourg
435
18
4,787
808
160
72nd
Wales
497
16
4,125
976
83
73rd
Sri Lanka
1,305
16
5,374
1,351
252
74th
Nepal
742
15
4,393
1,559
99
75th
Philippines
1,889
14
4,856
1,536
288
76th
Palestine
477
12
3,425
868
64
77th
Ecuador
2,955
12
3,444
1,096
29
78th
Venezuela
1,086
11
2,363
506
308
79th
Peru
3,287
10
3,036
810
179
80th
Brunei
190
10
3,258
623
561
81st
Malta
250
10
2,560
754
25
82nd
Latvia
1,002
10
2,491
777
36
83rd
Kenya
1,137
9
3,280
851
152
84th
Kazakhstan
11,234
9
3,670
1,160
161
85th
Cameroon
400
8
2,034
460
34
86th
Uruguay
444
8
3,974
749
59
87th
Kuwait
448
7
2,036
355
110
88th
Yemen
341
7
2,042
831
15
89th
Macedonia
664
7
2,032
520
229
90th
England
967
7
2,445
708
220
91st
Ethiopia
1,512
6
2,997
1,124
48
92nd
Libya
474
6
1,243
466
89
93rd
Syria
314
6
2,379
592
252
94th
Tanzania
500
5
1,605
353
59
95th
Cuba
957
5
1,264
411
338
96th
Sudan
449
5
1,239
330
19
97th
Iceland
606
5
1,782
371
130
98th
Malawi
100
5
774
244
36
99th
Northern Ireland
72
5
986
232
31
100th
Bosnia and Herzegovina
599
4
1,625
552
83
101st
Albania
477
4
2,483
955
6
102nd
Montenegro
134
4
877
336
47
103rd
Belarus
2,517
4
987
309
11
104th
Uganda
699
4
1,308
364
7
105th
Costa Rica
539
4
1,060
256
111
106th
Uzbekistan
2,006
4
774
285
13
107th
Guatemala
111
3
414
148
5
108th
Saint Kitts and Nevis
41
3
447
108
71
109th
Georgia
648
3
717
149
-
110th
Moldova
268
3
755
267
38
111th
Zimbabwe
321
3
1,258
304
34
112th
Botswana
224
3
963
254
3
113th
Scotland
462
3
1,912
448
187
114th
Cambodia
112
2
768
183
8
115th
Azerbaijan
1,018
2
1,087
374
60
116th
Panama
193
2
478
135
2
117th
Puerto Rico
307
2
645
130
84
118th
Fiji
421
2
836
153
2
119th
Papua New Guinea
50
2
292
90
1
120th
Paraguay
186
2
661
169
76
121st
Gabon
29
2
150
30
15
122nd
Bolivia
195
1
345
116
5
123rd
Jamaica
126
1
397
82
6
124th
Monaco
22
1
175
28
-
125th
Bahamas
52
1
445
84
-
126th
Guam
11
1
91
1
-
127th
Saint Lucia
3
1
269
64
4
128th
Benin
150
1
445
91
2
129th
Bahrain
235
1
868
322
17
130th
Mauritius
133
1
586
151
14
131st
Liechtenstein
18
1
456
42
1
132nd
Niger
39
1
195
38
1
133rd
Congo, Democratic Republic of the
66
1
193
46
-
134th
Haiti
74
1
123
61
1
135th
Mongolia
296
1
306
68
24
136th
Namibia
115
1
453
128
1
137th
Reunion
113
1
382
112
26
138th
Holy See
14
1
115
55
3
139th
Zambia
171
1
476
107
-
140th
Senegal
137
1
264
77
1
141st
Trinidad and Tobago
153
1
460
133
33
142nd
Kyrgyzstan
1,565
1
126
23
-
143rd
New Caledonia
116
1
262
29
-
144th
Nicaragua
113
1
323
68
39
145th
Virgin Islands
8
-
-
-
-
146th
Bophuthatswana
2
-
-
-
-
147th
Kosovo
160
-
358
114
1
148th
Netherlands Antilles
20
-
56
-
-
149th
Yugoslavia
36
-
1
1
-
150th
Turkmenistan
16
-
58
22
-
151st
Eswatini
45
-
96
44
-
152nd
Burkina Faso
87
-
127
23
-
153rd
Cape Verde
35
-
1
1
-
154th
Liberia
13
-
5
2
-
155th
Maldives
28
-
11
9
-
156th
Martinique
16
-
9
1
-
157th
Greenland
13
-
9
8
-
158th
French Guiana
30
-
128
35
-
159th
Niue
5
-
-
-
-
160th
Samoa
43
-
2
2
-
161st
Congo, Republic of the
27
-
3
3
1
162nd
Lesotho
36
-
98
20
-
163rd
Saint Vincent and the Grenadines
4
-
1
-
-
164th
Tajikistan
137
-
2
-
-
165th
Afghanistan
265
-
103
69
3
166th
Mauritania
12
-
11
8
-
167th
Solomon Islands
20
-
13
6
-
168th
Turks and Caicos Islands
9
-
4
-
-
169th
San Marino
11
-
15
3
-
170th
French Polynesia
22
-
54
24
-
171st
Bermuda
14
-
-
-
-
172nd
Somalia
59
-
110
21
-
173rd
Laos
39
-
34
11
-
174th
Seychelles
11
-
1
-
-
175th
Cote d'Ivoire
107
-
167
53
6
176th
Togo
39
-
142
50
5
177th
Armenia
385
-
181
46
3
178th
Dominican Republic
250
-
53
13
-
179th
Tonga
6
-
-
-
-
180th
Cayman Islands
13
-
52
9
3
181st
Central African Republic
13
-
-
-
-
182nd
Mali
37
-
14
10
-
183rd
Angola
87
-
35
18
-
184th
Chad
16
-
1
-
-
185th
Mozambique
125
-
99
37
-
186th
Faroe Islands
17
-
22
14
-
187th
Guinea
14
-
13
2
-
188th
Andorra
54
-
18
1
-
189th
Bhutan
49
-
63
15
-
190th
El Salvador
83
-
60
13
-
191st
Belize
22
-
35
2
-
192nd
Sierra Leone
20
-
39
14
-
193rd
Gambia
25
-
36
13
-
194th
Grenada
33
-
188
35
-
195th
North Korea
321
-
38
22
-
196th
Equatorial Guinea
5
-
-
-
-
197th
Djibouti
18
-
21
9
-
198th
Rwanda
394
-
143
38
-
199th
Antigua and Barbuda
20
-
2
-
-
200th
Dominica
11
-
-
-
-
201st
Burundi
15
-
11
8
-
202nd
Barbados
36
-
126
26
-
203rd
Madagascar
66
-
52
15
-
204th
Suriname
20
-
45
24
-
205th
Eritrea
18
-
39
12
-
206th
Montserrat
1
-
-
-
-
207th
South Sudan
14
-
8
5
-
208th
Guyana
20
-
17
-
-
209th
Guadeloupe
20
-
35
12
-
210th
Burma
151
-
327
121
6
211th
Honduras
89
-
152
28
-
212th
Gibraltar
13
-
-
-
-
213th
Comoros
7
-
-
-
-
214th
Guinea-Bissau
4
-
-
-
-
215th
Kiribati
10
-
-
-
-
216th
Marshall Islands
10
-
-
-
-
217th
Nauru
3
-
-
-
-
218th
Palau
6
-
2
-
-
219th
Sao Tome and Principe
11
-
-
-
-
220th
Timor-Leste (East Timor)
5
-
-
-
-
221st
Tuvalu
11
-
-
-
-
222nd
Vanuatu
24
-
6
-
-
223rd
Falkland Islands
-
-
-
-
-
224th
Micronesia
6
-
41
14
-
225th
British Virgin Islands
3
-
-
-
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment