Exercise

Working with maps from the maps package: adding points

Now that you have some polygons, there are a number of things you can do. Here you'll add some data points, namely the location of US cities with a population over 100,000 (population estimation as of 2015). Since you're only looking at the continental US, Honolulu, Hawaii and Anchorage, Alaska are not included.

The data is stored in the cities data frame. You'll begin by drawing points of varying sizes, relative to the estimated population. An alternative is to use color instead of size, and in this case a nice trick is to order the data frame, so that the largest cities are drawn on top of the smaller cities. This is so that they will stand out against the background, which is particularly effective when using the viridis color palette.

Instructions

100xp

Finish the first plot:

In the geom_point() layer: set data = cities, and inside aes(), map State onto group and Pop_est onto size. These are both variables in cities. The x and y aesthetics will be inherited from the original aes() definitions. Further customisations on geom_point() have been provided.

The code to create an arranged version of cities has already been provided.