def plot_whiteness(var, h, repeats=1000, axis=None):
    pr, q0, q = var.test_whiteness(h, repeats, True)

    if axis is None:
        axis = current_axis()

    pdf, _, _ = axis.hist(q0, 30, normed=True, label='surrogate distribution')
    axis.plot([q,q], [0,np.max(pdf)], 'r-', label='fitted model')

    #df = m*m*(h-p)
    #x = np.linspace(np.min(q0)*0.0, np.max(q0)*2.0, 100)
    #y = sp.stats.chi2.pdf(x, df)
    #hc = axis.plot(x, y, label='chi-squared distribution (df=%i)' % df)

    axis.set_title('significance: p = %f'%pr)
    axis.set_xlabel('Li-McLeod statistic (Q)')
    axis.set_ylabel('probability')

    axis.legend()

    return pr
Draw distribution of the Portmanteu whiteness test.
dataset/ETHPy150Open scot-dev/scot/scot/plotting.py/plot_whiteness