title: Moving legend to the bottom in ggplot2
body: <p>I have created the following heatmap. If you notice that the legend for cohort is on the right and the vertically placed. </p>
  
  <p>How do I move the legend to the bottom in order to give more space for X axis variable month M0 to M55...Also, you will notice that X axis elements are overlapping hence not clear.</p>
  
  <p>Output of the graph:</p>
  
  <p><a href="https://i.stack.imgur.com/9yKUr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9yKUr.png" alt="Snapshot of output"></a></p>
  
  <pre><code>cohort.clients&lt;-df1
  cohort.clients$cohort&lt;-as.character(cohort.clients$cohort)
  #we need to melt data
  cohort.chart.cl &lt;- melt(cohort.clients, id.vars = 'cohort')
  colnames(cohort.chart.cl) &lt;- c('cohort', 'month', 'clients')
  
  #define palette
  reds &lt;- colorRampPalette(c('light green',"dark green","yellow"))
  
  #plot data
  p &lt;- ggplot(cohort.chart.cl, aes(x=month, y=clients, group=cohort))
  p + geom_area(aes(fill = cohort)) +
    scale_fill_manual(values = reds(nrow(cohort.clients))) +
    ggtitle('Customer Cohort')
  </code></pre>