title: R - ggplot2: geom_area loses its fill if limits are defined to max and min values from a data.frame
body: <p>I am trying to reproduce a <code>sparkline</code> with ggplot2 like the one at the bottom of this image:</p>
  
  <p><a href="https://i.stack.imgur.com/4M9tk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4M9tk.png" alt="Example of Sparklines"></a></p>
  
  <p>Using the following code I get the result displayed at the end of the code.
  <strong>Note:</strong> My actual data.frame has only 2 rows. Therefore the result looks like a single line.</p>
  
  <pre><code># Create sparkline for MM monthly
  # sparkline(dailyMM2.aggregate.monthly$Count, type = 'line')
  p &lt;- ggplot(dailyMM2.aggregate.monthly, aes(x=seq(1:nrow(dailyMM2.aggregate.monthly)), y=Count)) + 
    geom_area(fill="#83CAF5") +
    geom_line(color = "#2C85BB", size = 1.5) +
    scale_x_continuous(expand=c(0,0)) +
    scale_y_continuous(expand=c(0,0))   
  
  p + theme(axis.line=element_blank(),axis.text.x=element_blank(),
            axis.text.y=element_blank(),axis.ticks=element_blank(),
            axis.title.x=element_blank(),
            axis.title.y=element_blank(),legend.position="none",
            panel.background=element_blank(),panel.border=element_blank(),panel.grid.major=element_blank(),
            panel.grid.minor=element_blank(),plot.background=element_blank())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YqaTK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YqaTK.png" alt="Sparkline1"></a></p>
  
  <p>However, as I try to only <code>show trends</code> with the sparkline and, therefore, absolute values aren't relevant for me, I have to adapt the config of the ggplot to limit the visible area between the min and max of my axis.y. I do it using the <code>limits</code> option:</p>
  
  <pre><code># Create sparkline for MM monthly
  # sparkline(dailyMM2.aggregate.monthly$Count, type = 'line')
  p &lt;- ggplot(dailyMM2.aggregate.monthly, aes(x=seq(1:nrow(dailyMM2.aggregate.monthly)), y=Count)) + 
    geom_area(fill="#83CAF5") +
    geom_line(color = "#2C85BB", size = 1.5) +
    scale_x_continuous(expand=c(0,0)) +
    scale_y_continuous(expand=c(0,0), limits = c(min(dailyMM2.aggregate.monthly$Count)-100, max(dailyMM2.aggregate.monthly$Count)+100))   
  
  p + theme(axis.line=element_blank(),axis.text.x=element_blank(),
            axis.text.y=element_blank(),axis.ticks=element_blank(),
            axis.title.x=element_blank(),
            axis.title.y=element_blank(),legend.position="none",
            panel.background=element_blank(),panel.border=element_blank(),panel.grid.major=element_blank(),
            panel.grid.minor=element_blank(),plot.background=element_blank())
  </code></pre>
  
  <p>However, the result is not like expected, as the whole geom_area's fill dissapears, as shown in the folllowing image:</p>
  
  <p><a href="https://i.stack.imgur.com/Mr4j9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mr4j9.png" alt="Sparkline 2"></a></p>
  
  <p>Can anyone shed light why this behaviour is happening and maybe help me with a proper way to solve this problem?</p>