title: Reverse color palette with legend limits ggplot2
body: <p>I have a set of polygons, an reproducable example here from code in <a href="https://stackoverflow.com/questions/26620373/spatialpolygons-creating-a-set-of-polygons-in-r-from-coordinates">this</a> question:</p>
  
  <pre><code># polygons
  square &lt;- t(replicate(8, {
  o &lt;- runif(2)
  c(o, o + c(0, 0.1), o + 0.1, o + c(0.1, 0), o)
  }))
  ID &lt;- paste0('sq', seq_len(nrow(square)))
  
  # Create SP
  polys &lt;- SpatialPolygons(mapply(function(poly, id) {
  xy &lt;- matrix(poly, ncol=2, byrow=TRUE)
  Polygons(list(Polygon(xy)), ID=id)
  }, split(square, row(square)), ID))
  
  # Create SPDF and add a column for values
  polys.df &lt;- SpatialPolygonsDataFrame(polys, data.frame(id=ID, row.names=ID))
  polys.df@data$number &lt;- c(1,2,3,4,5,6,7,8)
  </code></pre>
  
  <p>I then want to plot these with a single color palette, but want the highest numbers to be dark rather than light as in the default. After fortifying to use ggplot</p>
  
  <pre><code>f.polys = fortify(polys.df, region='id')
  f.polys = merge(f.polys, polys.df@data, by.x='id', by.y='id')   
  </code></pre>
  
  <p>I attempted to plot using a couple scale_fill_distiller options. So, this code works to set legend bar limits but doesn't reverse the palette:</p>
  
  <pre><code>ggplot() + 
  geom_polygon(data = f.polys, aes(x = long, y = lat, fill=number, group = group), color = 'black') + 
  scale_fill_distiller(palette = "Oranges", limits = c(0,10), breaks=c(0,2,8))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RH6Kem.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RH6Kem.jpg" alt="enter image description here"></a></p>
  
  <p>And this code reverses the palette, without being able to assign limits and breaks:</p>
  
  <pre><code>ggplot() + 
  geom_polygon(data = f.polys, aes(x = long, y = lat, fill=number, group = group), color = 'black') +
  scale_fill_distiller(palette = "Oranges", trans = 'reverse')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/M3vbvm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M3vbvm.jpg" alt="enter image description here"></a></p>
  
  <p>When I try to combine the scale_fill_distiller arguments the palette does not reverse and I lose the scale bar. Any recommendations? </p>
  
  <pre><code>ggplot() + 
  geom_polygon(data = f.polys, aes(x = long, y = lat, fill=number, group = group), color = 'black') +
  scale_fill_distiller(palette = "Oranges", trans = 'reverse',limits = c(0,10), breaks=c(0,2,8))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/HHJNfm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HHJNfm.jpg" alt="enter image description here"></a></p>