This week’s tidytuesday was all about police traffic stops. After I tinkered for a while I decided to make a map that visualizes the states with the largest gap in stop rates per race. For example, in Arizona 80% of all people who are stopped by the police are black. The only state where whites are stopped most often is Washington, but only by a small amount. My data analysis however is not perfect and potentially erroneous. I did not adjust the numbers to the number of people per race per state. Thus, keep in mind that this data visualization is more about the visualization than the actual data.

You can find the code for this visualization here.

What I learned

  • I learned how to plot the states of a country with the map_data function from the maps package.
  • I learned how to add geom_texts to a map. Actually it was quite simple. Since ggplot2 works with layers, I could just add another layer with the state labels.
  • I learned that the ggplot has a variable state.abb and state.name which include the abbreviations and names of the US states