title: world map - map halves of countries to different colors using ggplot2
body: <p>I'm looking for a ggplot2 solution for this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/13219387/world-map-map-halves-of-countries-to-different-colors">world map - map halves of countries to different colors</a></p>
  
  <p>I reproduce the example from that question below, which is based on the question here (<a href="https://stackoverflow.com/questions/9558040/ggplot-map-with-l">ggplot map with l</a>).</p>
  
  <pre><code>library(rgdal)
  library(ggplot2)
  library(maptools)
  
  # Data from http://thematicmapping.org/downloads/world_borders.php.
  # Direct link: http://thematicmapping.org/downloads/TM_WORLD_BORDERS_SIMPL-0.3.zip
  # Unpack and put the files in a dir 'data'
  
  gpclibPermit()
  world.map &lt;- readOGR(dsn="data", layer="TM_WORLD_BORDERS_SIMPL-0.3")
  world.ggmap &lt;- fortify(world.map, region = "NAME")
  
  n &lt;- length(unique(world.ggmap$id))
  df &lt;- data.frame(id = unique(world.ggmap$id),
                   growth = 4*runif(n),
                   category = factor(sample(1:5, n, replace=T)))
  
  ## noise
  df[c(sample(1:100,40)),c("growth", "category")] &lt;- NA
  
  
  ggplot(df, aes(map_id = id)) +
       geom_map(aes(fill = growth, color = category), map =world.ggmap) +
       expand_limits(x = world.ggmap$long, y = world.ggmap$lat) +
       scale_fill_gradient(low = "red", high = "blue", guide = "colorbar")
  </code></pre>