> From: MONTAGU Thierry [mailto:thierry.mont...@cea.fr] 
> Sent: Friday, May 21, 2010 09:37
> 
> has anyone ever tried to make a quantile-quantile plot with pylab?
> is there any build in function named say "qqplot" available ?

For a plot comparing samples to a theoretical distribution (and if you don't
need masking as in Paul's example), you might be able to use
scipy.stats.probplot, as follows:

    import matplotlib.pyplot as plt
    import scipy.stats as st

    values = st.norm.rvs(size=(100,))  # example data
    fig = plt.figure()                 # set up plot
    ax = fig.add_subplot(1, 1, 1)
    osm, osr = st.probplot(values, fit=0, dist='norm')  # compute
    ax.plot(osm, osr, '.')                              # plot

One way to include the fit line is

    (osm, osr), (m, b, r) = st.probplot(values, dist='norm')  # compute
    osmf = osm.take([0, -1])  # endpoints
    osrf = m * osmf + b       # fit line
    ax.plot(osm, osr, '.', osmf, osrf, '-')


------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to