title: Fill area above and below horizontal line with different colors
body: <p><strong>Aim</strong></p>
  <p>I am trying to fill the area between two lines in a plot generated with ggplot in R. I would like to fill everything between the lines above of the horizontal line with a different color than below the horizontal line.</p>
  <p>I succeeded to fill everything between the two lines with a single color, however, I did not manage to differentiate above and below the vertical line by two different colors.</p>
  <p><strong>Code</strong></p>
  <pre><code>set.seed(123) 
  
  # Load packages
  library(tidyverse)
  
  # Create sample dataframe
  df &lt;- data.frame(x=seq(1,50,1),y=runif(50, min = 0, max = 10))
  
  # Generate plot
  ggplot(data = df, aes(x = x, y = y)) +
    geom_line() +
    geom_hline(yintercept = 5) +
    theme_classic() +
    geom_ribbon(aes(ymin=5,ymax=y), fill=&quot;blue&quot;)
  </code></pre>
  <p><strong>Question</strong></p>
  <p>How do I fill the space above and below the horizontal line with a different color?</p>