title: Plotting Cumulative Gains Curve Plot R
body: <p>I am trying to generate a cumulative gain plot using <code>ggplot2</code> in R. Basically I want to replicate following using ggplot2.</p>
  
  <p><a href="https://i.stack.imgur.com/UxwEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UxwEo.png" alt=" "></a></p>
  
  <p>My Data is this </p>
  
  <pre><code>df
  # A tibble: 10 x 6
  Decile  resp Cumresp  Gain Cumlift
  &lt;int&gt;  &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt;   &lt;dbl&gt;
  1      8301    8301  57.7    5.77
  2      2449   10750  74.8    3.74
  3      1337   12087  84.0    2.80
  4       751   12838  89.3    2.23
  5       462   13300  92.5    1.85
  6       374   13674  95.1    1.58
  7       252   13926  96.8    1.38
  8       195   14121  98.2    1.23
  9       136   14257  99.1    1.10
  10       124   14381 100      1 
  
  ## Cumulative Gains Plot
  ggplot(df, aes(Decile,  Gain)) +
      geom_point() +
      geom_line() +
      geom_abline(intercept =  52.3 , slope = 4.77)
      scale_y_continuous(breaks = seq(0, 100, by = 20)) +
      scale_x_continuous(breaks = c(1:10)) +
      labs(title = "Cumulative Gains Plot",
       y = "Cumulative Gain %")
  </code></pre>
  
  <p>However, I am not able to get the diagonal line, even though I tried <code>geom_abline</code> or niether my <code>y-axis</code> is right. I could not start from <code>0 to 100</code>.</p>
  
  <p>I would really appreciate if someone can get me the plot as in picture using <code>ggplot2</code>.</p>
  
  <p>Thanks in advance </p>