Friday, March 15, 2019

Creating a simple world map of cities in R

Mike (from cool but useless) asked on twitter if there is any package in R with with lats/longs of lots of cities. In fact there is. Here is a simple code to create a world map of cities with population larger than 40K in R using maps::world.cities and ggplot2.

ps. These population data in the maps package refers to 2016 estimates. If you want city population data from previous years, you might remember that we have previously posted about this open dataset with 6,000 years of global urbanization.

2 comments:

3phaselemon said...

It looks a bit like there are problems with the data. China is similarly dense to Brazil...

Rafael H M Pereira said...

This is probably a matter of how one sets the color, transparency and size of the dots.