-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
94 lines (75 loc) · 2.6 KB
/
map.html
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
<!DOCTYPE html>
<html>
<head>
<!-- Include Vega-Lite and Vega-Lite-Embed libraries -->
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
</head>
<body>
<center><div id="world-map-airports-per-million"></div></center>
<script>
Airports_Per_Million_Map_Spec = {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": {
"text": "Numer of Airports Per One Million People Across Countries (2023)",
"anchor": "start"
},
"width": 800,
"height": 500,
"data": {
"url": "https://raw.githubusercontent.com/vega/vega-datasets/master/data/world-110m.json",
"format": {
"type": "topojson",
"feature": "countries"
}
},
"projection": {
"type": "equalEarth"
},
"transform": [{
"lookup": "id",
"from": {
"data": {
"url": "https://raw.githubusercontent.com/Nam-H-Pham/Earthquakes-Visualisation/main/data/airports_per_million.csv"
},
"key": "id",
"fields": ["Tier", "Iso Code", "Airports Per Million"]
}
}],
"layer": [
{
"data": {"sphere": true},
"mark": {"type": "geoshape", "fill": "aliceblue"}
},
{
"data": {"graticule": {"stepMinor": [15, 15]}},
"mark": "geoshape",
"encoding": {
"color": {"value": "#cccccc"}
}
},
{
"mark": {"type": "geoshape", "stroke": "#474747"},
"encoding": {
"color": {
"field": "Tier",
"title": "Airports Per One Million People",
"type": "quantitative",
"legend": {
"labelExpr": "datum.label == '1' ? '<1': datum.label == '2' ? '1-5' : datum.label == '3' ? '5-10' : datum.label == '4' ? '10-15' : datum.label == '5' ? '15-20' : datum.label == '6' ? '20-30' : datum.label == '7' ? '30-40' : datum.label == '8' ? '40-100' : datum.label == '9' ? '100-500' : datum.label == '10' ? '500-1000' : '<1'",
},
"bin": true,
},
"tooltip": [
{"field": "Iso Code", "type": "nominal"},
{"field": "Airports Per Million", "type": "quantitative", "format": ".2f"}
]
}
}
]
}
vegaEmbed("#world-map-airports-per-million", Airports_Per_Million_Map_Spec);
</script>
</body>
</html>