# histogram

Hi, just a small question about histogram. I saw that the

> result of the hist function from pylab and histogram from
> numpy+scipy can be slightly different when the array is
> big and with real data (not integer). I'll probably told
> something stupid but perhaps that will be good to have
> consistancies between both function, won't it?

JDH

Here a sample:

the data are in the file data.dat join.

In [1]: import pylab
In [2]: import scipy
In [3]: import scipy.stats

In [5]: pylab.hist(data1,20)
(Out[5]:
array([ 4, 6, 23, 52, 90, 128, 184, 244, 283, 293, 297, 330, 321,
231, 188, 140, 94, 48, 29, 15]),
array([ 0.00998046, 0.01054459, 0.01110872, 0.01167285, 0.01223698,
0.01280111, 0.01336524, 0.01392937, 0.0144935 , 0.01505763,
0.01562176, 0.01618589, 0.01675002, 0.01731415, 0.01787828,
0.01844241, 0.01900654, 0.01957067, 0.0201348 , 0.02069894]),
<a list of 20 Patch objects>)

In [6]: scipy.stats.histogram(data1,20)
Out[6]:
(array([ 1, 7, 17, 43, 75, 126, 185, 248, 303, 302, 314, 353, 315,
241, 178, 145, 70, 51, 20, 6]),
0.0096835454084847374,
0.00059382155039052636,
0)

data.dat (99 KB)

···

> Hi, just a small question about histogram. I saw that the
> result of the hist function from pylab and histogram from
> numpy+scipy can be slightly different when the array is
> big and with real data (not integer). I'll probably told
> something stupid but perhaps that will be good to have
> consistancies between both function, won't it?