title: How to make geom_ribbon have gradation color in ggplot2
body: <p><strong>I would like to make <code>geom_ribbon</code> have gradation color.</strong></p>
  
  <p>For example, I have <code>data.frame</code> as below;</p>
  
  <pre><code>df &lt;-data.frame(Day = c(rnorm(300, 3, 2.5), rnorm(150, 7, 2)), # create random data
                  Depth = c(rnorm(300, 6, 2.5), rnorm(150, 2, 2)),
                  group = c(rep('A', 300), rep('B', 150))) # add two groups
  </code></pre>
  
  <p>With this <code>data.frame</code>, I make <code>ggplot</code> using <code>geom_ribbon</code> as below</p>
  
  <pre><code>gg &lt;-
    ggplot(data=df,aes(x=Day))+  
    geom_ribbon(aes(ymin=Depth,ymax=max(Depth)),alpha = 0.25)+
    ylim(max(df$Depth),0)+
    facet_wrap(~group,scales = "free_x",ncol=2)+
    labs(x="Days(d)",y="Depth (m)")
  gg
  </code></pre>
  
  <p>, which makes a following plot;</p>
  
  <p><a href="https://i.stack.imgur.com/4F6iI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4F6iI.png" alt="enter image description here"></a></p>
  
  <p>Here, I would like to make the ribbon have gradation color by the value of y-axis (i.e. <code>df$Depth</code>, in this case). However, I do not how to do it. </p>
  
  <p>I can do it by geom_point as below;</p>
  
  <pre><code>gg &lt;- gg + 
    geom_point(aes(y=Depth,color=Depth),alpha = 1, shape = 20, size=5)+
    scale_color_gradient2(midpoint = 5, 
                          low = "red", mid="gray37", high = "black",
                          space ="Lab")
  gg  
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tFyEh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tFyEh.png" alt="enter image description here"></a></p>
  
  <p>But, I want the color gradation on ribbon by filling the ribbon area, not on each point. 
  Do you have any suggestion to do it with <code>geom_ribbon</code>?</p>