plfit/plfit_v1.py
def plotpdf(x,xmin,alpha,nbins=30,dolog=False):
    """
    Plots PDF and powerlaw....
    """

    x=sort(x)
    n=len(x)

    if dolog:
        hb = hist(x,bins=logspace(log10(min(x)),log10(max(x)),nbins),log=True)
        alpha += 1
    else:
        hb = hist(x,bins=linspace((min(x)),(max(x)),nbins))
    h,b=hb[0],hb[1]
    b = b[1:]

    q = x[x>=xmin]
    px = (alpha-1)/xmin * (q/xmin)**(-alpha)

    arg = argmin(abs(b-xmin))
    norm = mean( h[b>xmin] / ((alpha-1)/xmin * (b[b>xmin]/xmin)**(-alpha))  )
    px = px*norm

    loglog(q,px)

    gca().set_xlim(min(x),max(x))
def plotpdf(x,xmin,alpha,nbins=30,dolog=False):
    """
    Plots PDF and powerlaw....
    """

    x=sort(x)
    n=len(x)

    if dolog:
        hb = hist(x,bins=logspace(log10(min(x)),log10(max(x)),nbins),log=True)
        alpha += 1
    else:
        hb = hist(x,bins=linspace((min(x)),(max(x)),nbins))
    h,b=hb[0],hb[1]
    b = b[1:]

    q = x[x>=xmin]
    px = (alpha-1)/xmin * (q/xmin)**(-alpha)

    arg = argmin(abs(b-xmin))
    norm = mean( h[b>xmin] / ((alpha-1)/xmin * (b[b>xmin]/xmin)**(-alpha))  )
    px = px*norm

    loglog(q,px)

    gca().set_xlim(min(x),max(x))
Plots PDF and powerlaw....