Instructions

This is a map showing the 5 most populated cities of Greece. The size of each circle is representative of the city’s population. If you click on a circle, you will get a link to a wikipedia page with some information about the specific city.

suppressWarnings(library(leaflet))
df <- data.frame(City = c("Athens", "Thessaloniki", "Patras", "Heraklion", "Larissa"), 
                 lat = c(37.9839, 40.6401, 38.2466, 35.3387, 39.639), 
                 lng = c(23.7275, 22.9444, 21.7346, 25.1442, 22.4191), 
                 Population = c(3218218, 1012297, 168202, 153653, 144651))
                 
Links <- c(
    "<a href='https://en.wikipedia.org/wiki/Athens'>Athens</a>",
    "<a href='https://en.wikipedia.org/wiki/Thessaloniki'>Thessaloniki</a>",
    "<a href='https://en.wikipedia.org/wiki/Patras'>Patras</a>",
    "<a href='https://en.wikipedia.org/wiki/Heraklion'>Heraklion</a>",
    "<a href='https://en.wikipedia.org/wiki/Larissa'>Larissa</a>"
)
                 
df %>% 
    leaflet() %>%
    addTiles() %>%
    addCircleMarkers(lat = df$lat, lng = df$lng, weight = 1, 
                     radius = sqrt(df$Population)/40,
                     popup = Links)