Quantile-Quantile Plot using SciPy

后端 未结 9 1960
长情又很酷
长情又很酷 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条回答
  • 2020-12-04 07:14
    import numpy as np 
    import pylab 
    import scipy.stats as stats
    measurements = np.random.normal(loc = 20, scale = 5, size=100)   
    stats.probplot(measurements, dist="norm", plot=pylab)
    pylab.show()
    

    Here probplot draw the graph measurements vs normal distribution which speofied in dist="norm"

    0 讨论(0)
  • 2020-12-04 07:15

    I think that scipy.stats.probplot will do what you want. See the documentation for more detail.

    import numpy as np 
    import pylab 
    import scipy.stats as stats
    
    measurements = np.random.normal(loc = 20, scale = 5, size=100)   
    stats.probplot(measurements, dist="norm", plot=pylab)
    pylab.show()
    

    Result

    enter image description here

    0 讨论(0)
  • 2020-12-04 07:17

    It exists now in the statsmodels package:

    http://statsmodels.sourceforge.net/devel/generated/statsmodels.graphics.gofplots.qqplot.html

    0 讨论(0)
提交回复
热议问题