Hello users,
I have the following code, works perfectly:
**
world110m = dataset("world-110m")
# canvas
canvas = @vlplot(
width = 640,
height = 360,
title = "Big cities in the world",
projection = {type = :equalEarth}
)
# world map
worldmap = @vlplot(
data = {
values = world110m,
format = {
type = :topojson,
feature = :countries
}
},
mark = {
type = :geoshape,
fill = :lightgray,
stroke = :white
}
)
# combine layers
cidades_mundo = DataFrame(CSV.File("cidades_mundo.csv"))
# world map
# location markers for state capitals
cidades = @vlplot(
data = cidades_mundo,
mark = {:circle, size=3},
latitude = "latitude:q",
longitude = "longitude:q",
color = {value = :red}
)
# names of state capitals
nomes_cidades = @vlplot(
data = cidades_mundo,
mark = {
type = :text,
dy = 3,
fontSize = 3
},
latitude = "latitude:q",
longitude = "longitude:q",
text = "id:n"
)
# combine layers
p = canvas + worldmap + cidades + nomes_cidades
whose output is a map with 50 cities:
The list of the cities is the csv
id,latitude,longitude
1,35.6895,139.7670
2,28.7041,77.1025
3,31.2304,121.4737
4,19.0759,72.8777
5,-23.5505,-46.6333
6,19.4326,-99.1332
7,34.6937,135.5022
8,22.5726,88.3639
9,23.8103,90.4125
10,39.9042,116.4074
11,40.7128,-74.0060
12,-34.6037,-58.3816
13,34.0522,-118.2437
14,-22.9068,-43.1729
15,52.5200,13.4050
16,51.5074,-0.1278
17,40.4168,-3.7038
18,48.8566,2.3522
19,41.8781,-87.6298
20,43.6532,-79.3832
21,-6.1745,106.8227
22,37.5665,126.9779
23,22.3964,114.1095
24,41.8719,12.4964
25,13.7563,100.5018
26,41.3879,2.1690
27,45.4642,9.1895
28,59.3258,18.0683
29,48.2082,16.3738
30,52.2319,21.0068
31,47.4979,19.0402
32,50.0755,14.4378
33,37.9833,23.7333
34,38.7223,-9.1393
35,47.3686,8.5392
36,46.2044,6.1432
37,1.3521,103.8198
38,37.7749,-122.4194
39,42.3584,-71.0596
40,47.6067,-122.3321
41,53.3498,-6.2603
42,52.3702,4.8952
43,56.9496,24.1049
44,54.6872,25.2797
45,59.4372,24.7536
46,60.1699,24.9384
47,59.9139,10.7522
48,55.6761,12.5683
49,64.08,-21.93
50,59.3258,18.0683
My question is the following: how can I connect some cities? For example, plot lines between cities from 1 to 2, from 3 to 4, from 5 to 10, from 10 to 20? I need to draw and now connect some points.
I am not used deal with @vlplot
.
Many thanks.