Re: [Matplotlib-users] incorrect boxplot?

2009-12-20 Thread Andrew Straw
Robert Kern wrote:
 On 2009-09-14 13:49 PM, Gökhan Sever wrote:
   
 On Mon, Sep 14, 2009 at 12:30 PM, jason-s...@creativetrax.com
 mailto:jason-s...@creativetrax.com wrote:

 I tried the following (most output text is deleted):

 In [1]: ob1=[1,1,2,2,1,2,4,3,2,2,2,3,4,5,6,7,8,9,7,6,4,5,5]
 In [2]: import matplotlib.pyplot as
 plt
 In [3]:
 plt.figure()
 In [4]:
 plt.boxplot(ob1)
 In [5]:
 plt.savefig('test.png')
 In [6]: import
 scipy.stats
 In [7]:
 scipy.stats.scoreatpercentile(ob1,75)
 Out[7]: 5.5


 Note that the 75th percentile is 5.5.  R agrees with this calculation.
 However, in the boxplot, the top of the box is around 6, not 5.5.  Isn't
 the top of the box supposed to be at the 75th percentile?

 Thanks,

 Jason

 --
 Jason Grout


 From  matplotlib/lib/matplotlib/axes.py

 You can see how matplotlib calculating percentiles. And yes it doesn't
 conform with scipy's scoreatpercentile()


  # get median and quartiles
  q1, med, q3 = mlab.prctile(d,[25,50,75])

 I[36]: q1
 O[36]: 2.0

 I[37]: med
 O[37]: 4.0

 I[38]: q3
 O[38]: 6.0


 Could this be due to a rounding? I don't know, but I am curious to hear
 the explanations for this discrepancy.
 

 prctile does not handle the case where the exact percentile lies between two 
 items. scoreatpercentile does.
   
Fixed in r8039.


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] incorrect boxplot?

2009-09-14 Thread jason-sage
I tried the following (most output text is deleted):

In [1]: ob1=[1,1,2,2,1,2,4,3,2,2,2,3,4,5,6,7,8,9,7,6,4,5,5]
In [2]: import matplotlib.pyplot as 
plt   
In [3]: 
plt.figure()  
In [4]: 
plt.boxplot(ob1)  
In [5]: 
plt.savefig('test.png')   
In [6]: import 
scipy.stats
In [7]: 
scipy.stats.scoreatpercentile(ob1,75) 
Out[7]: 5.5


Note that the 75th percentile is 5.5.  R agrees with this calculation.  
However, in the boxplot, the top of the box is around 6, not 5.5.  Isn't 
the top of the box supposed to be at the 75th percentile?

Thanks,

Jason

--
Jason Grout


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] incorrect boxplot?

2009-09-14 Thread Gökhan Sever
On Mon, Sep 14, 2009 at 12:30 PM, jason-s...@creativetrax.com wrote:

 I tried the following (most output text is deleted):

 In [1]: ob1=[1,1,2,2,1,2,4,3,2,2,2,3,4,5,6,7,8,9,7,6,4,5,5]
 In [2]: import matplotlib.pyplot as
 plt
 In [3]:
 plt.figure()
 In [4]:
 plt.boxplot(ob1)
 In [5]:
 plt.savefig('test.png')
 In [6]: import
 scipy.stats
 In [7]:
 scipy.stats.scoreatpercentile(ob1,75)
 Out[7]: 5.5


 Note that the 75th percentile is 5.5.  R agrees with this calculation.
 However, in the boxplot, the top of the box is around 6, not 5.5.  Isn't
 the top of the box supposed to be at the 75th percentile?

 Thanks,

 Jason

 --
 Jason Grout


From  matplotlib/lib/matplotlib/axes.py

You can see how matplotlib calculating percentiles. And yes it doesn't
conform with scipy's scoreatpercentile()


# get median and quartiles
q1, med, q3 = mlab.prctile(d,[25,50,75])

I[36]: q1
O[36]: 2.0

I[37]: med
O[37]: 4.0

I[38]: q3
O[38]: 6.0


Could this be due to a rounding? I don't know, but I am curious to hear the
explanations for this discrepancy.




-- 
Gökhan
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] incorrect boxplot?

2009-09-14 Thread Robert Kern
On 2009-09-14 13:49 PM, Gökhan Sever wrote:


 On Mon, Sep 14, 2009 at 12:30 PM, jason-s...@creativetrax.com
 mailto:jason-s...@creativetrax.com wrote:

 I tried the following (most output text is deleted):

 In [1]: ob1=[1,1,2,2,1,2,4,3,2,2,2,3,4,5,6,7,8,9,7,6,4,5,5]
 In [2]: import matplotlib.pyplot as
 plt
 In [3]:
 plt.figure()
 In [4]:
 plt.boxplot(ob1)
 In [5]:
 plt.savefig('test.png')
 In [6]: import
 scipy.stats
 In [7]:
 scipy.stats.scoreatpercentile(ob1,75)
 Out[7]: 5.5


 Note that the 75th percentile is 5.5.  R agrees with this calculation.
 However, in the boxplot, the top of the box is around 6, not 5.5.  Isn't
 the top of the box supposed to be at the 75th percentile?

 Thanks,

 Jason

 --
 Jason Grout


 From  matplotlib/lib/matplotlib/axes.py

 You can see how matplotlib calculating percentiles. And yes it doesn't
 conform with scipy's scoreatpercentile()


  # get median and quartiles
  q1, med, q3 = mlab.prctile(d,[25,50,75])

 I[36]: q1
 O[36]: 2.0

 I[37]: med
 O[37]: 4.0

 I[38]: q3
 O[38]: 6.0


 Could this be due to a rounding? I don't know, but I am curious to hear
 the explanations for this discrepancy.

prctile does not handle the case where the exact percentile lies between two 
items. scoreatpercentile does.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] incorrect boxplot?

2009-09-14 Thread jason-sage
Robert Kern wrote:
 prctile does not handle the case where the exact percentile lies between two 
 items. scoreatpercentile does.

   

If mlab is supposed to be compatible with matlab, then isn't this a problem?

 From matlab, version 7.2.0.283 (R2006a)

  prctile([1 1 2 2 1 2 4 3 2 2 2 3 4 5 6 7 8 9 7 6 4 5 5],[0 25 50 75 
100])

ans =

1.2.4.5.75009.


Of course, the 75th percentile is different here too (5.75 instead of 
scipy's 5.5).  I don't know how to explain that discrepancy.

Jason


--
Jason Grout



--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users