title: Why is 'curve' so different from 'lines' and 'points' in R?
body: <p>I would like to fit the frequency data with discrete generalized beta distribution (<a href="http://www.plosone.org/article/info:doi/10.1371/journal.pone.0004791" rel="nofollow noreferrer">DGBD</a>).</p>
  <p>The data look like this:</p>
  <pre><code>freq = c(1116, 2067, 137 ,  124, 643,  2042, 55  ,47186,  7504, 1488, 211,   1608,   
           3517 , 7  , 896  ,  378, 17 ,3098, 164977  ,  601 ,  196, 637, 149 , 44,2 ,  1801, 882   , 636,5184,  1851,  776 ,   343   , 851, 33  ,4011,   209,  715 , 
           937 , 20,   6922, 2028 , 23,  3045 , 16 , 334,  31 ,  2)
  
  Rank = rank(-freq, ties.method = c(&quot;first&quot;) )
  p = freq/sum(freq)
  </code></pre>
  <h1>get the log forms</h1>
  <pre><code>log.f = log(freq)
  log.p = log(p)
  log.rank = log(Rank)
  log.inverse.rank = log(length(Rank)+1-Rank)
  </code></pre>
  <h1>linear regression of the discrete generalized beta distribution</h1>
  <pre><code>co=coef(lm(log.p~log.inverse.rank + log.rank))
  zmf = function(x) exp(co[[1]]+ co[[2]]*log(length(x)+1-x) + co[[3]]*log(x))
  </code></pre>
  <h1>plot</h1>
  <pre><code>plot(p~Rank, xlim = c(1, 80), log = &quot;xy&quot;,xlab = &quot;Rank (log)&quot;, ylab = &quot;Probability (log)&quot;)
  curve(zmf, col=&quot;blue&quot;, add = T)
  xx=c(1:length(Rank))
  lines(zmf(xx)~xx, col = &quot;red&quot;)
  points(zmf(xx)~xx, col = &quot;purple&quot;)
  </code></pre>
  <p><img src="https://i.stack.imgur.com/sznUQ.png" alt="enter image description here" /></p>
  <h3>Figure 1. the plot looks like this</h3>
  <h3>My question is what is the right way to demonstrate the result? lines (points) or curve?</h3>
  <h1>Update:</h1>
  <p>Although I have not figured out the underling logic, the solution is found:</p>
  <p>@Frank reminds me to notice the trick of setting the length of n in the curve. It solves the problem. Thus, n in curve is necessary when we try to fit the raw data. Although in many situations, n is ignored.</p>
  <pre><code>plot(p~Rank, log = &quot;xy&quot;,xlab = &quot;Rank (log)&quot;, ylab = &quot;Probability (log)&quot;)
  curve(zmf, col=&quot;blue&quot;, add = T, n = length(Rank)) # set the the number of x values at which to evaluate.
  </code></pre>
  <p><img src="https://i.stack.imgur.com/PlQG4.png" alt="enter image description here" /></p>
  <h3>　Figure 2 The right way to use curve: specify the 'n'</h3>