title: Position legend in first plot of facet
body: <p>I would like to put my plot legend inside the plot, inside the first plot of a facet.</p>
  
  <p>Here is some example code:</p>
  
  <pre><code>df=data.frame(
   x=runif(10),
   y=runif(10),
   facet=rep(c("a","b"),5),
   color=rep(c("red","blue"),5))
  
  ggplot(data=df,aes(x=x,y=y,color=color))+
   geom_point()+
   facet_wrap(~facet,ncol=1)
  </code></pre>
  
  <p>Here is the resulting plot:</p>
  
  <p><img src="https://i.stack.imgur.com/0KYQ7.jpg" alt="plot with legend on outside"></p>
  
  <p>And here is roughly how I would like it to look:</p>
  
  <p><img src="https://i.stack.imgur.com/l4Nfr.jpg" alt="plot with legend inside"></p>
  
  <p>Thanks for any help you can provide!</p>