我正试图在《世界地图集》中绘制一份世界地图,其中我拥有数据的每个国家(并非每个国家)都以与该国数据相比的渐进式颜色填满——在这种情况下,所管理的方格检测数量——或总数——测试。 使用Im的数据是从一个实例数据集一中收集的。 图卢布是上述地图,所有地方都有这些分界线。
我迄今为止的《区域法典》是;
install.packages("maps")
library(maps)
map_data_subset <- subset(covid, select = c("Country", "Continent","Total_tests", "Total_Deaths", "Total_Deaths_Per_Million"))
country_tests_deaths <- na.omit(map_data_subset)
world_map <- map_data("world")
merged_data <- merge(world_map, country_tests_deaths, by.x = "region", by.y = "Country", all.x = TRUE)
# Plotting map
ggplot(data = merged_data, aes(x = long, y = lat, group = group, fill = Total_tests)) +
geom_polygon(color = "white") +
scale_fill_gradient(low = "skyblue", high = "navyblue", name = "Your Legend") +
theme_minimal()
我的麻烦是,我的世界地图像上面那样看着——谁能告诉我,为什么,以及我如何确定? 我有一个小nch子,可能是与世界地图数据做的,该数据有十万row,而我的测试数据只有100.,但不能确定这种数据是否真实,也难以确定。
EDIT - 下面是N.omit数据集 我愿向世界地图转达;
> print(map_data_subset, n=104)
# A tibble: 104 × 2
Country Total_tests
<chr> <dbl>
1 Andorra 215733
2 Argentina 24156096
3 Armenia 1770914
4 Australia 39943525
5 Austria 90377770
6 Azerbaijan 4952737
7 Bahamas 147633
8 Bahrain 6612314
9 Bangladesh 9907321
10 Belgium 20514883
11 Belize 278894
12 Bhutan 1160858
13 Bolivia 2456130
14 Bosnia and Herzegovina 1253492
15 Bulgaria 4990220
16 Canada 44186056
17 Chile 22194480
18 Colombia 25954762
19 Costa Rica 1927328
20 Cote d Ivoire 1029903
21 Croatia 2913176
22 Cyprus 13835984
23 Denmark 41501675
24 Ecuador 1761061
25 Equatorial Guinea 230491
26 Estonia 1997046
27 Ethiopia 3557710
28 Finland 7224917
29 Gabon 1188832
30 Georgia 8900000
31 Germany 75158696
32 Greece 21991126
33 Guatemala 2228737
34 Hong Kong 25906063
35 Hungary 6620866
36 Iceland 650933
37 India 583631490
38 Iran 33350660
39 Iraq 15338457
40 Ireland 7668724
41 Israel 28327710
42 Italy 95331171
43 Jamaica 617665
44 Japan 24344819
45 Jordan 10237614
46 Kosovo 1217376
47 Kuwait 4389988
48 Laos 612410
49 Liechtenstein 69730
50 Lithuania 5381950
51 Luxembourg 3543784
52 Maldives 1543706
53 Malta 1306982
54 Mexico 10389202
55 Moldova 1822979
56 Mongolia 4074039
57 Morocco 8853903
58 Mozambique 901901
59 Myanmar 4376017
60 Namibia 713463
61 Nepal 4256803
62 Netherlands 13409992
63 New Zealand 3602589
64 Nigeria 3142971
65 Norway 7864561
66 Pakistan 19911021
67 Panama 3906709
68 Paraguay 1846953
69 Philippines 20507811
70 Poland 20707050
71 Portugal 19023656
72 Qatar 2723342
73 Romania 13294804
74 Russia 195638185
75 Rwanda 2938657
76 Saint Kitts and Nevis 46380
77 Saint Vincent and the Grenadines 77176
78 Saudi Arabia 29430910
79 Senegal 828629
80 Serbia 5874429
81 Singapore 20436387
82 Slovakia 42271380
83 Slovenia 1626242
84 South Africa 17864698
85 South Korea 13721674
86 Spain 59314343
87 Sri Lanka 5355028
88 Switzerland 10760244
89 Taiwan 3619373
90 Thailand 14201188
91 Timor 209126
92 Togo 518580
93 Trinidad and Tobago 353373
94 Tunisia 2994047
95 Turkey 90162700
96 Uganda 1705808
97 Ukraine 13277259
98 United Arab Emirates 87246490
99 United Kingdom 283376305
100 United States 592381867
101 Uruguay 3635691
102 Vietnam 24871501
103 Zambia 2509600
104 Zimbabwe 1288436
提前感谢, Freddy