Profile pic

Paolo Di Lorenzo

GitHub GitHub GitHub

data / usmap v0.2.0 released
29 Apr 2017 • by Paolo Di Lorenzo

I finally got around to updating usmap to version 0.2.0. This version adds the crucial feature of adding data to your maps so that you can create colorful choropleths. This is done by using the map_with_data function to retrieve a data frame. Alternatively, the plot_usmap function has been updated to allow a data parameter to be defined.
Here is an example of such a plot:

State population choropleth

This map shows the population of each state as of 2015. The code to create this is as follows:


  plot_usmap(data = statepop, values = "pop_2015") + 
    scale_fill_continuous(low = "white", high = "red", name = "Population (2015)", label = scales::dollar) +
    scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) +
    theme(legend.position = "right")

As you can see we utilize the extensibility of ggplot2 to create a nice map complete with a key.

The mapping vignette has been updated with more examples of the new functionality. Be sure to view the documentation for more help with plot_usmap and map_with_data.


More features and fixes will be added soon as I move the package towards a stable 1.0 release. As always please check out the Github repo for more information and to suggest/add new features.