title: Plot multivariate Gaussian contours with ggplot2
body: <p>I'm trying to augment a plot with contours from a 2D Gaussian distribution with known mean and covariance. Ideally I would just have to specify the function and it would be plotted in 2D (like <code>stat_function</code> except for 2 dimensions). I can do it with <code>geom_raster</code> by generating a grid of probabilites. Can I use <code>geom_contour2d</code> somehow instead?</p>
  
  <pre><code>m &lt;- c(.5, -.5)
  sigma &lt;- matrix(c(1,.5,.5,1), nrow=2)
  data.grid &lt;- expand.grid(s.1 = seq(-3, 3, length.out=200), s.2 = seq(-3, 3, length.out=200))
  q.samp &lt;- cbind(data.grid, prob = mvtnorm::dmvnorm(data.grid, mean = m, sigma = sigma))
  ggplot(q.samp, aes(x=s.1, y=s.2)) + 
      geom_raster(aes(fill = prob)) +
      coord_fixed(xlim = c(-3, 3), ylim = c(-3, 3), ratio = 1)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dOFxg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dOFxg.png" alt="enter image description here"></a></p>