Search code examples
rplotloglog

Double-log density plot


I have a generated a data set with power law distribution using poweRlaw package with the following code:

library("poweRlaw")
xmin = 1; alpha = 1.5
con_rns = rplcon(1000, xmin, alpha)

How can I get a log-log plot where x-axis is showing log(m) and y-axis showing log(freq(m)) for all m in the dataset?


Solution

  • I got the solution:

    library("poweRlaw")
    xmin = 1; alpha = 1.5
    x = rplcon(1000, xmin, alpha)
    h <- hist(x, plot=F, breaks=c(seq(0,max(x)+1, .1)))
    plot(h$counts, log="xy", pch=20, col="blue",xlab="Value", ylab="Frequency")
    

    enter image description here