Quantile-Quantile Plot using SciPy

后端 未结 9 1975
长情又很酷
长情又很酷 2020-12-04 06:44

How would you create a qq-plot using Python?

Assuming that you have a large set of measurements and are using some plotting function that takes XY-values as input. T

9条回答
  •  萌比男神i
    2020-12-04 06:58

    How big is your sample? Here is another option to test your data against any distribution using OpenTURNS library. In the example below, I generate a sample x of 1.000.000 numbers from a Uniform distribution and test it against a Normal distribution. You can replace x by your data if you reshape it as x= [[x1], [x2], .., [xn]]

    import openturns as ot
    
    x = ot.Uniform().getSample(1000000)
    g = ot.VisualTest.DrawQQplot(x, ot.Normal())
    g
    

    In my Jupyter Notebook, I see:

    If you are writing a script, you can do it more properly

    from openturns.viewer import View`
    import matplotlib.pyplot as plt
    View(g)
    plt.show()
    

提交回复
热议问题