title: how to plot degree distribution in R
body: <p>I would like to know whether the output of a script to plot a degree distribution can be correct. </p>
  
  <p>So the script is ( where the vector with the degrees of all my vertices is stored in x):</p>
  
  <p>x is </p>
  
  <pre><code>x
   [1] 7 9 8 5 6 2 8 9 7 5 2 4 6 9 2 6 10 8 
  </code></pre>
  
  <p>x is the degree of a certain network vertice  - like vertice 1 has degree 7, vertice 2 has degree 9 and so on 
      x &lt;- v2
      summary(x)</p>
  
  <pre><code>library(igraph)
  split.screen(c(1,2))
  screen(1)
  plot (tabulate(x), log = "xy", ylab = "Frequency (log scale)", xlab = "Degree (log scale)", main = "Log-log plot of degree distribution")
  screen(2)
  y &lt;- (length(x) - rank(x, ties.method = "first"))/length(x)
  plot(x, y, log = "xy", ylab = "Fraction with min. degree k (log scale)", xlab = "Degree (k) (log scale)", main = "Cumulative log-log plot of degree distribution")
  close.screen(all = TRUE)
  power.law.fit(x, xmin = 50)
  </code></pre>
  
  <p>My problem is that the log-log plot seems to be incorrect - for instance, I have the degree '7' 8 times overall so shouldn't this point on a log-log plot become 0.845 (log 7)/ 0.903 (log(8) as in (x/y)? </p>
  
  <p>Moreover, can somebody tell me how to fit the line ( the power-law on the log-log scale) to the plot in the screen 2 ?</p>