Hi! I wanted to visualize map of Zimbabwe where each state has a different colour and each state represents the average age of respondents.
I previously tried it with tmap but it was fruitless.
Currently I am trying with ggplot2.
Below is the code I have done so far-
zimbabwe_map <- map_data("world", region = "zimbabwe")
ggplot(data = zimbabwe_map, aes(x = long, y = lat, group = group)) +
geom_polygon(data = zimbabwe_map, fill = "lightblue", color = "purple") +
coord_fixed(1.4) +
theme_void()
I recommend you take a look at the sf() package to learn about plotting maps and using shapefiles. I found a nice article from Edzer Pebesma that should help you start.
Based on your code, you can create a Zimbabwe geometry with