title: Using ggplot2 to Fill in Counties Based on FIPS Code
body: <p>I am looking to fill in counties on a ggplot2 US map from a vector of FIPS codes that I am interested in. I would like to do this using ggplot2 and its various functions such as geom_map and geom_polygon as they seem to offer quite a lot of flexibility in customisation, however I have only managed to accomplish a rudimentary version using choropleth. The rudimentary version is:</p>
  
  <pre><code>library(choroplethr)
  library(ggplot2)
  library(dplyr)
  library(tidyverse)
  library(choroplethrMaps)
  
  onesvec &lt;- rep(100000, 210)
  county &lt;- data.frame(region = OOTFIPS, value = onesvec)
  
  data(county)
  
  choro              = CountyChoropleth$new(county)
  choro$ggplot_scale = scale_fill_brewer(name="Population", palette=2, drop=FALSE)
  choro$render() 
  </code></pre>
  
  <p>which gives <a href="https://i.stack.imgur.com/vlrr6.jpg" rel="nofollow noreferrer">this</a>. Here OOTFIPS is a vector of the FIPS codes. To make this work, I have had to create a fake "value" vector so that it will highlight the counties desired from the OOTFIPS vector.</p>
  
  <p>Starting with ggplot2, when I make a first pass I cant even get an accurate map. I have started with this code</p>
  
  <pre><code>counties &lt;- map_data("county")
  ggplot() + geom_polygon(data = counties, aes(x = long, y = lat))
  </code></pre>
  
  <p>but it returns a map that isn't even <a href="https://i.stack.imgur.com/ENMBG.png" rel="nofollow noreferrer">geographically accurate</a>. Any advice on how to make a map similar to the first image but with the techniques from the second?</p>
  
  <p>Thanks!</p>
  
  <pre><code>ExampleFIPS &lt;- data.frame("FIPS" = c(19097, 17155, 50009, 27055, 39143, 55113, 44003, 55011, 19105, 46109, 19179, 55099, 51057))
  </code></pre>
  
  <p>Edit: Here is as far as I have been able to manage</p>
  
  <pre><code>states &lt;- map_data("state")
  counties &lt;- map_data("county")
  
  us_base &lt;- ggplot(data = states, mapping = aes(x = long, y = lat, group = group)) + coord_fixed(1.3) + 
    geom_polygon(color = "black", fill = "white")
  
  
  us_base + theme_void() + geom_polygon(data = counties, fill = NA, color = "gray") +
    geom_polygon(color = "black", fill = NA)
  </code></pre>
  
  <p>But now the question is how to specify and highlight counties with FIPS codes in the vector?</p>