title: How to make a ggplot2 contour plot analogue to lattice:filled.contour()?
body: <p>I've been learning ggplot2, and hope to use it for all my R graphing. However, I've yet to find a way to make a contour plot that looks analogous to a conventional contour plot, like what can be obtained using lattice:filled.contour(). For example:</p>
  
  <pre><code>#define data
  x&lt;-seq(1,11,1)
  y&lt;-seq(1,11,1)
  xyz.func&lt;-function(x,y) {-10.4+6.53*x+6.53*y-0.167*x^2-0.167*y^2+0.0500*x*y}
  
  #contour plot using lattice graphics and R Color Brewer
  library(lattice) #for filled.contour()
  library(RColorBrewer) #for brewer.pal()
  z.lattice&lt;-outer(x,y,xyz.func)
  filled.contour(x,y,z.lattice,nlevels=6,col=brewer.pal(6,"YlOrRd"))
  </code></pre>
  
  <p>This gives me a nice contour plot.</p>
  
  <p><img src="https://i.stack.imgur.com/b9fwS.png" alt="enter image description here"></p>
  
  <p>Now, let's try the same thing in ggplot2.  The best I can come up with, based on everything I've read  (particularly <a href="https://stackoverflow.com/questions/21868353/drawing-labels-on-flat-section-of-contour-lines-in-ggplot2">Drawing labels on flat section of contour lines in ggplot2</a>) is:</p>
  
  <pre><code>#contour plot using ggplot2
  library(ggplot2)
  library(reshape2) #for melt()
  z.molten&lt;-melt(z.lattice) 
  names(z.molten) &lt;- c("x", "y", "z")
  v&lt;-ggplot(z.molten, aes(x,y,z=z))+
      geom_tile(aes(fill=z))+
      stat_contour(bins=6,aes(x,y,z=z), color="black", size=0.6)+
      scale_fill_gradientn(colours=brewer.pal(6,"YlOrRd"))
  v
  </code></pre>
  
  <p>This graph has the same basic idea as filled.contour(), but the colored tiles don't conform to the contours very well.</p>
  
  <p><img src="https://i.stack.imgur.com/Qiol6.png" alt="enter image description here"></p>
  
  <p>I haven't been successful with changing the sizes of the tiles, either.</p>
  
  <p>Any suggestions on how to make ggplot2's output closer to filled.contour()'s output?</p>